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

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

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

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

相关文章

微信公众号

最新文章

更多