本文整理了Java中com.google.ar.sceneform.math.Quaternion.rotateVector
方法的一些代码示例,展示了Quaternion.rotateVector
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quaternion.rotateVector
方法的具体详情如下:
包路径:com.google.ar.sceneform.math.Quaternion
类名称:Quaternion
方法名:rotateVector
暂无
代码示例来源:origin: googlesamples/sceneform-samples
lerp(rotations.get(segmentIndex), rotations.get(segmentIndex + 1), .5f);
Vector3 rightDirection =
Quaternion.rotateVector(averagedRotation, Vector3.right()).normalized();
Vector3 upDirection = Quaternion.rotateVector(averagedRotation, Vector3.up()).normalized();
代码示例来源:origin: google-ar/sceneform-android-sdk
/**
* When translating, the up direction of the node must match the up direction of the plane from
* the hit result. However, we also need to make sure that the original forward direction of the
* node is respected.
*/
private Quaternion calculateFinalDesiredLocalRotation(Quaternion desiredLocalRotation) {
// Get a rotation just to the up direction.
// Otherwise, the node will spin around as you rotate.
Vector3 rotatedUp = Quaternion.rotateVector(desiredLocalRotation, Vector3.up());
desiredLocalRotation = Quaternion.rotationBetweenVectors(Vector3.up(), rotatedUp);
// Adjust the rotation to make sure the node maintains the same forward direction.
Quaternion forwardInLocal =
Quaternion.rotationBetweenVectors(Vector3.forward(), initialForwardInLocal);
desiredLocalRotation = Quaternion.multiply(desiredLocalRotation, forwardInLocal);
return desiredLocalRotation.normalized();
}
代码示例来源:origin: googlesamples/sceneform-samples
Quaternion.rotateVector(rotationFromAToB, Vector3.forward()).normalized();
Vector3 rightDirection =
Quaternion.rotateVector(rotationFromAToB, Vector3.right()).normalized();
Vector3 upDirection = Quaternion.rotateVector(rotationFromAToB, Vector3.up()).normalized();
desiredUp.set(upDirection);
内容来源于网络,如有侵权,请联系作者删除!