Collision for Nodes from imported j3o

Hello,

first: if this is a duplicate please let me know, second: Though i am quite experienced in Java development, i am still new to the JME3 and its api´s.

So i have been trying to find a solution for that, for quite some time and had no sucess until now, i will try to be as specific as possible.

My basic setup is that i imported the Town scene from This Tutorial, the difference is the player.

While the tutorial uses a first person view, i have a game state, which contains a node(X), this node contains two child nodes, the first is the character model it self and the second is a camera node, with the camera beeing the camera from the SimpleApplication object.
Note: the Character is a j3o loaded trough assetManager#loadModel
I than move and rotate the Camera node a bit to create a third person view.
The node(X) gets than attached to the rootNote from SimpleApplication.
To move the character, i basically move the Node(X), which moves the two sub nodes(character and camera node).

So now that i explained my setup, here my question:
How can i create a collision/physics system for the first sub node of X, which is the character.

If there is an article/docs which covers this topic, i would be more than thankful for the link to it.
If you can help me, i would appriciate if you could give me a whole example since i´m new to jme3 and quite unexperienced.

Regards,
Liz3

A short answer is add a BetterCharacterControl sized for your model to your node X.

see also:
https://wiki.jmonkeyengine.org/jme3/beginner/hello_physics.html
https://javadoc.jmonkeyengine.org/com/jme3/bullet/control/BetterCharacterControl.html

An longer answer is read this:
https://wiki.jmonkeyengine.org/jme3/advanced/jme3_ai.html

which also goes into animations, 3rd person view cam, picking, navigation meshes, AppStates, Controls etc, using the basic example listed here.

This is not the be all end all for this, just an slightly more in depth example that combines several techniques used in beginner tutorials.

1 Like