Move/rotate method isnt working with physicsNode

I updated to the latest revision a few minutes back, any my code suddenly broke.



the issues are the following.


  1. I cannt use this code any more,

    [java]CompoundCollisionShape cs_basicPlatform = CollisionShapeFactory.createMeshCompoundShape(geo_basicPlatform);[/java] (this code is still in the doc)

    Instead I have to use,

    [java]CollisionShape cs_basicPlatform = CollisionShapeFactory.createMeshShape(geo_basicPlatform);[/java]

    are they same?


  2. I cant move the physics node with move/rotate method any more. But, I was using ‘setKinematic(true) and then move/rotate methods’ to ‘relocate and move’ those platforms(PhysicsNode).

    Now If i have to re position a physics node, and use forces to move it every time, is this even an easy way to think?

    Like, an uniformly infinitely rotating platform on its axis, on which a player will walk. :?

In the screen shot, I attached a boxCollision shape at the size of the upper portion of the rotatin platform(where it player can walk), then i rotated the PhysicsNode using rotate method, and it worked find.(I had to setKinematic to true)…this was before updating jMP







After update, everything is broke. I cannt move the platfrom using rotate method.I tried different ways, but all ended up in failure. Its just so frustrating. I cannt use force cause, the object is kinetic and i cannt set it to false, cause the lower portion of the platform is dipped in the ground.



in the pic i am using

CollisionShape cs_basicRotating = CollisionShapeFactory.createDynamicMeshShape(geo_basicRotating);

pn_basicRotating.setKinematic(true);



the piller is dipped at the bottom, which is a MeshShape.

CollisionShape cs_ground= CollisionShapeFactory.createMeshShape(geo_ground);



All, i want is to, put again a box collision shape at the top, where the player can walk, and the platform will rotate uniformly on its axis.

Yeah, the constant geometry to physics updates in updateGeometricState were causing lots of problems so they are no longer available. Physics objects are no longer a Node but a Control, the PhysicsNode is just a Node with a PhysicsRigidBodyControl now. You can extend PhysicsRigidBodyControl and apply the geometry location each frame or something or simply use setPhysicsLocation of the PhysicsNode or RigidBodyControl.

for translation i solved the issue, using the following code:

[java]pn_basicLeftRight2.move(0, 0, -12.5f *tpf); //though, dubugShape shows the PhysicsNode is not moving,but the Geo is moving

pn_basicLeftRight2.setPhysicsLocation(pn_basicLeftRight2.getLocalTranslation());[/java]



for rotatinon i did,

[java] pn_basicRotating.rotate(0,0.15f * tpf, 0);

pn_basicRotating.setPhysicsRotation(pn_basicRotating.getLocalRotation().toRotationMatrix());[/java]



Is this the way it should be?

Well, you dont need to do it twice, just use the setPhysicsLocation/Rotation, it will be applied to the objects.

How do i ‘rotate’ an object at the same line, when it(in the parameter) is actually asking for ‘the rotation’?

Look at the move or rotate methods. (right-click->navigate to source)

i was saying

physicsNode1.setPhysicsRotation( physicsNode1.rotate(rotation_Value).getCurrentRotationValueOfPhysicsNode1 )



here, i am rotating and measuring the rotation at the same time…it looks weird!!



what exactly am i missing? :frowning:

Well, do it like you did before, I guess its the easiest way right now because Spatial has the methods you need. Generally you would do

physicsNode.setPhysicsRotation(physicsNode.getPhysicsRotation().multLocal(addQuaternion));