How do I update my physics mesh?

In this scene, I have one rectangular prism parented to another. Their physics are set to rigid body with compound collision. With logic nodes, I’m using the “apply rotation” node to rotate a rectangular prism. I want the collider (physics mesh) to rotate too. Is this possible?

1 Like

Compound collision physics to my knowledge cannot be dynamically updated.

Warning
If the object is a part of a compound object it will fail (parent or child)

Hinted here: https://upbge.org/#/documentation/docs/latest/api/bge.types.KX_GameObject.html#bge.types.KX_GameObject.reinstancePhysicsMesh

And partially here: https://github.com/mikepan/GameEngineBook/blob/master/text/04-Animation.md#graphic-mesh-vs-physic-shape-

You know the game called, “the little crane that could”? It’s about a crane that moves around objects. I want to make something similar where there is a robotic arm you can control. I’ve tried rigid body joints, but I can’t get them to work.
Either:

  1. The rigid body joint allows rotation along an axis, so the robotic arm won’t stay in place.
  2. I disable rotation along the joint axis & can’t rotate the arm.
  3. I use a “rotate to” node to make the arm rotate towards an empty, but it isn’t exact enough & is glitchy.
  4. I set the arms location to an empty & rotate the empty to control the arm, but the arm gets jittery when it touches objects.
  5. Rotate the joints, but the arm can move through objects.

I’m just trying to make a robotic arm. Logic nodes or bricks preferred.

re-parent the compound physics objects after you move them (each frame). not a perfect solution, but it works. be sure to have “compound” checked on the parent actuator.

obj.reinstancePhysicsMesh() 

That function only updates physics for “mesh” changes, not “transform” changes.

Also, did you not read my initial post at all, I already shared that same function above…

And the warning shared with it. I guess I’ll share it again too:

Warning
If the object is a part of a compound object it will fail (parent or child)

no, i only skimmed trough it.

To fix this problem just animate it with a bone then release obj.reinstancePhysicsMesh() on the mesh, that works.

Then another issue will persist - lag.

Warning
Rebuilding the physics mesh can be slow, running many times per second will give a performance hit.

a few items will be ok, i’m using it here so to test if their pc can do it just download it and see if you get lag, i don’t get any lag at all.