我想擺脫過時的「CharacterControl」客場「BetterCharacterControl」爲3D遊戲,我在JMonkeyEngine3搞亂這裏是我到目前爲止的代碼發起他們:如何訪問JMonkeyEngine3中BetterCharacterControl對象的Vector3f位置?
public void initPlayer(){
// We set up collision detection for the player by creating
// a capsule collision shape and a CharacterControl.
CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
player = new CharacterControl(capsuleShape, 0.05f);
player.setJumpSpeed(20);
player.setFallSpeed(30);
player.setGravity(30);
player.setPhysicsLocation(new Vector3f(-10, 10, 10));
bulletAppState.getPhysicsSpace().add(player);
}
public void initBetterPlayer(){
CapsuleCollisionShape betterCapsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
betterPlayer = new BetterCharacterControl(2f,6f,1f);
// set basic physical properties:
betterPlayer.setJumpForce(new Vector3f(0,5f,0));
betterPlayer.setGravity(new Vector3f(0, 1f ,0));
betterPlayer.warp(new Vector3f(-10, 10, 10));
bulletAppState.getPhysicsSpace().add(betterPlayer);
}
在initBetterPlayer()我也具有CapsuleCollisionShape鏈接到betterPlayer麻煩。
這裏是我的simpleUpdate使用位置()方法:
player.setWalkDirection(walkDirection);
cam.setLocation(player.getPhysicsLocation());
的問題是不存在像getPhysicsLocation()用於BetterCharacterControl看來,只有保護現場沒有一種方法被稱爲「位置」 。
任何輸入,非常感謝。