[SOLVED] Spatial look at with character control

i have spatial with the physics

    //ini player
    player = (Spatial) assetManager.loadModel("Models/char.glb");
    //init player physics
    SphereCollisionShape sphereShape = new SphereCollisionShape(1.2f);
    characterControl = new CharacterControl( sphereShape , 1.2f );
    player.addControl(characterControl);
     bulletAppState.getPhysicsSpace().add(player);
    rootNode.attachChild(player);
    characterControl.setPhysicsLocation(new Vector3f(0,5f,0));

        player.lookAt(new Vector3f(10,10,10), Vector3f.UNIT_Y);

not working
if i delete character control work correctly

1 Like

Once a spatial is associated with a physics body, you will need to move and rotate it by calling methods on the physics body.

In this specific case you want this method:

https://javadoc.jmonkeyengine.org/v3.3.0-beta1/com/jme3/bullet/control/CharacterControl.html#setViewDirection-com.jme3.math.Vector3f-

2 Likes

Big thanks

2 Likes