Tag: jmonkeyengine

在OpenGL中获取X,Y和Z轴上的弧度相机旋转?

我正在尝试在OpenGL中的各个轴上获取相机旋转(但具体使用Java,LWJGL和jME)。 相机对象允许我将方向作为Vector3f,但这似乎不能用于获得分量旋转; 每个轴显示与另一个轴相关联。 我发现带有偏移的角度分量toAngleAxis是一个快速的黑客,但在大多数情况下无法正常工作。 不幸的是,我不太擅长数学,否则我可能已经解决了这个问题:)再次,我只需要X,Y和Z轴分量和弧度,从0弧度到2 PI弧度。 有人可以帮忙吗? 克里斯,先生干杯谢谢

四元数平滑旋转

四元数不仅可以描述旋转,还可以描述方向,即从初始(零)位置旋转。 我希望模拟从一个方向到另一个方向的平滑旋转。 我计算了起始方向startOrientation和end orientation endOrientation并且希望将中间方向描述为startOrientation*(1-argument) + endOrientation*argument而argument从0变为1 。 猴子引擎更新function的代码如下: @Override public void simpleUpdate(float tpf) { if( endOrientation != null ) { if( !started ) { started = true; } else { fraction += tpf * speed; argument = (float) ((1 – Math.cos(fraction * Math.PI)) / 2); orientation = startOrientation.mult(1-argument).add(endOrientation.mult(argument)); //orientation = startOrientation.mult(1-fraction).add(endOrientation.mult(fraction)); log.debug(“tpf = {}, […]

如何改善3D游戏的角色控制?

由于我从辅助类CharacterControl更改为新的BetterCharacterControl我注意到一些改进,例如推动其他角色正在工作,但我的主角已经开始滑过步骤而无法爬上更高的台阶。 我必须跳过上面不是正确的比赛方式,它应该只是走过去。 旧的帮助器类CharacterControl有一个默认的不滑动方式,只是走过几步,我认为可以通过改变我创建主角的代码来纠正它。 private void createNinja() { ninjaNode = (Node) assetManager .loadModel(“Models/Ninja/Ninja.mesh.xml”); ninjaNode.setShadowMode(RenderQueue.ShadowMode.CastAndReceive); ninjaNode.setLocalScale(0.06f); ninjaNode.setLocalTranslation(new Vector3f(55, 3.3f, -60)); ninjaControl = new BetterCharacterControl(2, 4, 0.5f); ninjaControl.setJumpForce(new Vector3f(6, 6, 6)); ninjaNode.addControl(ninjaControl); rootNode.attachChild(ninjaNode); bulletAppState.getPhysicsSpace().add(ninjaControl); getPhysicsSpace().add(ninjaControl); animationControl = ninjaNode.getControl(AnimControl.class); animationChannel = animationControl.createChannel(); } 完整的代码是 package adventure; import com.jme3.system.AppSettings; import java.io.File; import com.jme3.renderer.queue.RenderQueue; import com.jme3.renderer.queue.RenderQueue.ShadowMode; import com.jme3.animation.AnimChannel; import com.jme3.animation.AnimControl; import […]