Problem with physics rotation

Hello. Sorry for my bad english. I’m trying to write a game like neverball but i have a problem with interaction between terrain and ball.

My terrain is a matrix of quad all attached to a node (terrain). To this node i attach a rigid body :



terreno_rigid_control = new RigidBodyControl(0);

this.addControl(terreno_rigid_control);

this.setLocalTranslation(getCentroTerreno());

bulletAppState.getPhysicsSpace().addAll(this);



the problem is that when i rotate the node terrain the ball that is on the terrain sometimes it moves and sometimes it doesn’t , or starts to fall down.

It is such as the “buondingVolume” of the node terrain doesn’t rotate with the terrain.



I tried also to use this.getControl(RigidBodyControl.class).applyTorque(new Vector3f().UNIT_X.mult(2));

to rotate the node but it doesn’t work because the node have mass zero ( otherwise the terrain start to fall down)



I

Zero mass objects may not be moved. Use kinematic objects with mass.

Thx for reply. There are examples, or tips that u can suggest to me?

i tried to find it into jme3 examples(examples from svn) but i have there is nothing…:frowning:

only thing i’ve found is

Cinematic c = new Cinematic(Node) and attach to it a rotationTrack cinematic event?



I’m going crazy . . . i’m trying to do it from 3 weeks ! eheh

Thx really a lot for reply!

I suggest you do all tutorials from beginning to end even if they dont explain exactly what you want to do at this moment they will show you how the basics of moving objects etc works. Then the advanced stuff will be much easier for you.

cinematic do not solve :frowning:



http://www.imageupload.org/?d=B283684E1



press play and start cinematic event motionTrack (2pi rotation) but the ball do not fall down :frowning:



http://www.imageupload.org/?d=510669981





thx lot…



have a Good work!

If you want a physics object to be moved by a cinematic path you have to set it to kinematic mode. You would have learned that doing the tutorials, too.

1 Like

really thx .

just set setKinematic(true); , and reset the localtranslation and it work!



thx :stuck_out_tongue: