com.jme3.scene.Spatial.lookAt()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(109)

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

Spatial.lookAt介绍

[英]lookAt is a convenience method for auto-setting the local rotation based on a position in world space and an up vector. It computes the rotation to transform the z-axis to point onto 'position' and the y-axis to 'up'. Unlike Quaternion#lookAt(com.jme3.math.Vector3f,com.jme3.math.Vector3f)this method takes a world position to look at and not a relative direction. Note : 28/01/2013 this method has been fixed as it was not taking into account the parent rotation. This was resulting in improper rotation when the spatial had rotated parent nodes. This method is intended to work in world space, so no matter what parent graph the spatial has, it will look at the given position in world space.
[中]lookAt是一种基于世界空间中的位置和上方向向量自动设置局部旋转的便捷方法。它计算旋转,将z轴变换为“位置”,将y轴变换为“向上”。与四元数#lookAt(com.jme3.math.Vector3f,com.jme3.math.Vector3f)不同,该方法需要查看世界位置,而不是相对方向。注:2013年1月28日由于未考虑母公司轮换,该方法已被修正。当空间节点旋转父节点时,这会导致不正确的旋转。这种方法的目的是在世界空间中工作,因此无论空间中有什么父图形,它都会查看世界空间中的给定位置。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

case LookAt:
  if (lookAt != null) {
    spatial.lookAt(lookAt, upVector);

代码示例来源:origin: org.jmonkeyengine/jme3-core

case LookAt:
  if (lookAt != null) {
    spatial.lookAt(lookAt, upVector);

相关文章

Spatial类方法