本文整理了Java中com.google.ar.sceneform.math.Quaternion.lookRotation
方法的一些代码示例,展示了Quaternion.lookRotation
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quaternion.lookRotation
方法的具体详情如下:
包路径:com.google.ar.sceneform.math.Quaternion
类名称: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);
内容来源于网络,如有侵权,请联系作者删除!