本文整理了Java中com.google.ar.sceneform.math.Quaternion.axisAngle
方法的一些代码示例,展示了Quaternion.axisAngle
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quaternion.axisAngle
方法的具体详情如下:
包路径:com.google.ar.sceneform.math.Quaternion
类名称:Quaternion
方法名:axisAngle
暂无
代码示例来源:origin: google-ar/sceneform-android-sdk
/** Returns an ObjectAnimator that makes this node rotate. */
private static ObjectAnimator createAnimator() {
// Node's setLocalRotation method accepts Quaternions as parameters.
// First, set up orientations that will animate a circle.
Quaternion orientation1 = Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), 0);
Quaternion orientation2 = Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), 120);
Quaternion orientation3 = Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), 240);
Quaternion orientation4 = Quaternion.axisAngle(new Vector3(0.0f, 1.0f, 0.0f), 360);
ObjectAnimator orbitAnimation = new ObjectAnimator();
orbitAnimation.setObjectValues(orientation1, orientation2, orientation3, orientation4);
// Next, give it the localRotation property.
orbitAnimation.setPropertyName("localRotation");
// Use Sceneform's QuaternionEvaluator.
orbitAnimation.setEvaluator(new QuaternionEvaluator());
// Allow orbitAnimation to repeat forever
orbitAnimation.setRepeatCount(ObjectAnimator.INFINITE);
orbitAnimation.setRepeatMode(ObjectAnimator.RESTART);
orbitAnimation.setInterpolator(new LinearInterpolator());
orbitAnimation.setAutoCancel(true);
return orbitAnimation;
}
}
代码示例来源:origin: googlesamples/sceneform-samples
@Override
public void onUpdate(FrameTime frameTime) {
float speed = (degreesPerSecond * frameTime.getDeltaSeconds());
Quaternion deltaRot = Quaternion.axisAngle(Vector3.up(), speedMultiplier * speed);
setLocalRotation(Quaternion.multiply(getLocalRotation(), deltaRot));
}
内容来源于网络,如有侵权,请联系作者删除!