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

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

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

Quaternion.lookRotation介绍

暂无

代码示例

代码示例来源:origin: google-ar/sceneform-android-sdk

@Override
 public void onUpdate(FrameTime frameTime) {
  if (infoCard == null) {
   return;
  }

  // Typically, getScene() will never return null because onUpdate() is only called when the node
  // is in the scene.
  // However, if onUpdate is called explicitly or if the node is removed from the scene on a
  // different thread during onUpdate, then getScene may be null.
  if (getScene() == null) {
   return;
  }
  Vector3 cameraPosition = getScene().getCamera().getWorldPosition();
  Vector3 cardPosition = infoCard.getWorldPosition();
  Vector3 direction = Vector3.subtract(cameraPosition, cardPosition);
  Quaternion lookRotation = Quaternion.lookRotation(direction, Vector3.up());
  infoCard.setWorldRotation(lookRotation);
 }
}

代码示例来源:origin: googlesamples/sceneform-samples

Quaternion rotationFromAToB = Quaternion.lookRotation(directionFromTopToBottom, desiredUp);

相关文章

微信公众号

最新文章

更多