Alright, I’m very new to JME and graphics in general so take this all with a grain of salt, but maybe I can try to explain.
I’ll try to start with the very basics and build up the way I understand it.
You wish to have a physics model for your character. There are various ways to do this which are supported by JME. One is you can have your character’s physics modeled by the actual graphical representation (by that I mean the polyhedron that you’re looking at). This seems natural, but like many attempts to make things realistic, it can lead to disaster. Unless you have quite a lot of sophisticated code for biped locomotion, your model is going to fall over when it tries to walk or even stand. If you wish to see this, you can give your model a dynamic mesh shape, and then try to move it by applying a force on it. The code by the way, for this, is something like (although this is incomplete)
CollisionShape player_shape = CollisionShapeFactory.createDynamicMeshShape(player);
RigidBodyControl player_physics = new RigidBodyControl(player_shape, 100.0f);
I do not recommend doing this, however.
It is more natural to model your character’s physics with a shape which doesn’t fall over, like a cube or something. The capsule shape provided is most definitely not the best solution to this problem for any model, but it is something which works pretty much ok no matter what model you’re using, and is pretty simple and straight forward.
Thus in your example video, the player IS standing on the ground with his physical representation (which is invisible). Your job is
to shift the player’s graphical representation so that he appears to be standing on the ground with his graphical representation.
(You could also try fiddling with the size and position of the capsule, but I’ll show you how to shift the player’s spatial)
I would arrange this like so:
You have a node to which you are attaching your model’s physics control, probably the root node.
You have a node to which you are attaching your model’s graphics “root node”, probably the physics control node.
You have a node which is sort of like the root node for your model’s graphics.
If your model only has one spatial, all you’re going to hang on the model node is the spatial, otherwise you might put more.
You then wish to shift the model downward. The best way to do this is to move the model’s graphics node, although if you only have
one spatial in your model you could also shift the spatial.
Now assume we are just attaching a character with one spatial to the root node:
Code (untested):
character_control_node.attachChild(whateverSpatialYou’reUsing);
whateverSpatialYou’reUsing.move(0,some negative number,0)
Your character control node is then attached to the root node.
Does this make sense?
We create a node, on which we hang our spatial, and then shift the spatial downwards.
The character control node is the node to which you add a physics control for the character, thus we are changing the relative locations
of the physics model for the character which the graphical representation of it.
If you wish to allow for more than one spatial on your character, add an additional node “character_node”, which you attach to character_control_node, and then attach your character’s spatials to character_node. You can have further nesting of nodes if you wish, but that’s another topic.
Thanks for this question, actually… I just realized I had this very problem myself and just fixed it by doing exactly what I showed you