How to add spatial into scene

Hello ,

Q . WHAT I WANT TO DO ?

ANS- I want to move the spatial object added to the scene as moving player.

i am doing the Hello Collision tutorial…in the code i want to add the model - “Models/Oto/Oto.mesh.xml” , which was used in HelloAnimation tutorial.

I m adding it as Spatial Object…like this

[java] CapsuleCollisionShape capsuleShape = new CapsuleCollisionShape(1.5f, 6f, 1);
player = new CharacterControl(capsuleShape, 0.05f);

Spatial cube = assetManager.loadModel("Models/Oto/Oto.mesh.xml");

player.setSpatial(cube);[/java]

and i added the cube to root node like this

[java] rootNode.attachChild(cube);[/java]

But it is displaying the the model into the scene as attached into the floor.

How can i change the coordinate of the spatial element and how do i move it like the player moves.

OUTPUT SCENE -

Please Help , email me anshul.katta@gmail.com

Thanks
Anshul

Attach the ninja to a Node, move the ninja up by y-Extent and then attach the CharacterControl, or newer BetterCharacterControl to the Node not the ninja.

Move it with SetWalkDirection and SetViewDirection for orientation

1 Like

Also look at jme3test.bullet.TestPhysicsCharacter
The content of this post is meant to be read as a straight information or question without an implicit dismissive stance or interest in having the other party feel offended unless there’s emotes that hint otherwise or there’s an increased use of exclamation marks and all-capital words.

1 Like

it worked , @wezrule , thank you :slight_smile: