DPN.clearDynamics() does not remove all forces

clearDynamics() does not remove all Forces attached to my nodes.



How the forces are applied…


        node.addForce(appliedForce);
        node2.addForce(appliedForce);
        node.addForce(camzdir.mult(-span));
        node2.addForce(camzdir.mult(span));



This should remove the dynamics in a physics callback. In fact the spplied force is removed, the camzdir... forces are not removed and continue to meove the node.


         public void afterStep( PhysicsSpace space, float time ) {
            cursor.getDynamicNode().clearDynamics();
            cursor.getDynamicNode2().clearDynamics();
         }



Maybe anyone has a solution or a more sophisticated way to move nodes smoothly without using forces...

Yes, I mostly fits my needs, but as it doesn't allow exact positioning of picked nodes in 3D space I'll have to adapt it. My idea was not ot use the two diemensional mouse cursor, but to use this and the mouse wheel to control an additional node, which is able two grab a component between two subnodes.

This means to create the joints to hold the dragged object on collision events and not on mouse clicks…

Hum… Isn't there any possibility to tie a Joint to a StaticPhysicsNode? My idea was to have two of them to grab a box from both sides, but this does not seem to work for me. Is there a common workaround for that issue?

  1. You should not need clearDynamic to move something smoothly.
  2. clearDynamics in afterStep removes velocities only, as forces are 0 either way (check e.g. ODE documentation for an explanation of physics simulation steps). This means the addForce before the step already moves the objects, clearDynamics only reduces it's speed to 0 afterwards.

Hm, okay…



I'm currently using forces and clearDynamics to move a "cursor" object. I'll check if I can find something like set velocity, but this would also mean that I will somehow have to remove the velocity after a mouse movement or any thing…

Or maybe by just having loops with translations…



Anyway, thank you…

there is also setLinerarVelocity() maybe you can use that

Sounds like using joints would be better. Does PhysicsPicker probably suite your needs or can be adapted?

Attaching to a static node means attaching to the environment - just use the attach(DPN) method, with a single parameter.