How-to add physics to a mesh opbject?

Hi all,

First off let me begin with the following disclaimer: this is my first venture into 3d software and my first few evenings messing with jMonkey, i usually write custom business apps.

I tried to add the ninja from the helloAssets and the physics from testSimplePhysics with some sollutions from this page:


Spatial ninja = assetManager.loadModel(“Models/Ninja/Ninja.mesh.xml”);

ninja.scale(0.05f, 0.05f, 0.05f);

//ninja.rotate(0.0f, -3.0f, 0.0f);

ninja.setLocalTranslation(0.0f, -5.0f, -2.0f);

BoxCollisionShape ninjaColllisionShape = new BoxCollisionShape();

RigidBodyControl tri_phy = new RigidBodyControl(ninjaColllisionShape, 2f);





Basically i just wanted a box around the ninja because i intend on a tile-based 3d or at least isometric game…

Needless to say i got some NullReference Exceptions from this …

stackstrace ends up in (

any pointers ? (or ‘by-values’ as the java case may be :wink: )

Hmm, while this does indeed give me food for thought, it does not tell me exactly what i did wrong, but i will tinker with this.

Thank you.

You didn’t initialize the box. Its got an empty constructor.

that didn’t make any ninja’s appear either (sadly) but i will RTFM before bothering you further :slight_smile:

1 Like