Need advice on a few things

I hope someone of you who have a deeper understanding of the physics engine can help me. I'm currently working on a game where the user can move certain objects around in a scene. The user sees a topview of the scene and can select an object and move it around. I kind of got it working so far by attaching a joint to the object and use that to let the object follow the joint position. This technique is also used in PhysicsPicker.



Now I have a couple of problems with this technique.


  1. When moving a box and one of its corner is touching a wall it seems to pivot on that corner causing it to rotate, I rather have it slide against the wall in its current rotation.

    For example:




  2. All the objects that are movable need to be dynamic so I'm using DynamicPhysicsNode. When a object bounches against another object it send the other object into a certain direction. I rather have all objects I'm not moving to be "solid" and not move when another object collides with it. I tried several techniques such as using setEnabled(false) on the other objects to make them stay in the same place but this basically disables the physics on the object causing it to not be in the collision calculation pass. Giving these objects a huge amount of mass helps a little but they still move a little and this technique just doesn't feel right.



    Please help, I have spent so many "wasted" hours on this already :frowning:

For your case it should be enough to just reset torque and local rotation of the box each frame before rendering.

Thanks! That solved my problem with the rotation. I actually tried it before but it didn't work because I forgot to update the geometry state after resetting the rotation.

I'm still wondering about the second problem. Maybe I should make every object a StaticPhysicsNode and when selecting one cast it to DynamicPhysicsNode. This way the others won't move when the dynamic one bounches against them. Will try this out later. If you have a better idea I'd love to hear it.

Casting won't help. Replacing static with dynamic would be possible and even fast, but quite complicated. What about tying them with a fixed joint (without axes) to the world? (A joint attached to only one physics node is attached to the environment on the other side).

Maybe casting wasn't the right word since I meant replacing, sorry about that  ://. Using a fixed joint seems to work perfectly. Thanks a lot! :slight_smile: