Attaching a CameraNode to the player perspective when the player is a CapsuleShaped Character Contro

My code is as below.

Basically my problem is that, following the documentation, i get stuck because neither the capsule shape nor the CharacterControl have an attachChild() function

the xxxx is where ‘player’ would be in the documentation (called’ target’ there)

(my apologies if this looks like a double post, the forum may or may not have glitched on me, i cant find my first try under my account tab)

private void initPlayer() { CapsuleCollisionShape playerShape = new CapsuleCollisionShape(2f, 3f, 2); player = new CharacterControl(playerShape, 3f);
    player.setPhysicsLocation(new Vector3f(-25, 575, -25));

    camNode = new CameraNode("CamNode", cam);
    camNode.setLocalTranslation(new Vector3f(0, 300, 0));
    camNode.lookAt(player.getViewDirection(), Vector3f.UNIT_Y); 


The CharacterControl only controls how the model behave with physics, it’s not a Spatial that is part of the scene graph.

You can only attach Nodes to Nodes. You probably have a model for your player that you added to the rootNode?

you have the make a playerNode that is a plain Node and attach it to the rootNode. Then attach the player geometry to it and the camNode.

Then keep your code for the character control, it’s fine.

Sounds so simple when you put it like that :smiley: thanks