Transforming spatials after adding them to the physics space

Hi All,

My question is this: How do I transform (move/scale/etc) after i add a rigidBodyControl to it and add it to the physics space. Because transformation like i’m doing it now does not seem to work,

Here’s some of the code…
[java] Spatial test= assetManager.loadModel(“Models/tepee.j3o”);
Material tentMaterial = assetManager.loadMaterial(“Materials/treebark.j3m”);

     test.setLocalTranslation(100f, 5f, 100f); //SO THIS ALL WORKS!

     CollisionShape testShape = CollisionShapeFactory.createMeshShape(test);           
     RigidBodyControl testBody = new RigidBodyControl(testShape, 0);

      test.move(100f, 5f, 100f); //BUT THIS HAS NO EFFECT ANYMORE!

This should be possible right? Because there are many reasons why you would want do this.
I have the feeling that i’m missing/not getting something,

Thanks All.

Use setPhysicsLocation and setPhysicsRotation. See also

And of course, in addition to that, you can use forces to move the physics objects.

Oh and setPhysicsLocation and setPhysics rotation has to be applied to the physics body, not to the spatial.

1 Like

You can set it to kinematic and move your spatial like that, I dunno if setscale would update the collisionshape (never tried it). But if you want proper physics then you should move it with forces

If you use setPhysicsLocation you can’t expect proper physics results on collisions etc. Either set it to kinematic or move it with forces.

I usually use setPhysicsLocation/Rotation once to set the initial position and location. After that, everything is moved and rotated with forces indeed.

I am not sure what cruelmove is trying to achieve, but most likely the direction to be followed is clear for now :amused: .

Ah thanks all, it’s much clearer now… especially the stuff on the advanced physics page, can’t believe that I missed that one…
One more question though, is there some way to change the scale of non-Kinematic objects? (because a setPhysicsScale function appears to be absent…)

The scale is set on the collision shape in bullet hence it cannot be put to the geometry scale (as all other objects using that shape would scale too). You can scale the collision shape though.