com.google.ar.sceneform.math.Quaternion.rotateVector()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(56)

本文整理了Java中com.google.ar.sceneform.math.Quaternion.rotateVector方法的一些代码示例,展示了Quaternion.rotateVector的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quaternion.rotateVector方法的具体详情如下:
包路径:com.google.ar.sceneform.math.Quaternion
类名称:Quaternion
方法名:rotateVector

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);

相关文章

微信公众号

最新文章

更多