Maintain velocity and rotation after changing physics shape?

From what I understand, the only way to change a physics object’s shape is to remove it and create it again. But I’m making a game where you should be able to change shape while it’s moving, for example a square to a circle. So, I somehow need to copy the physics state from the previous shape to the new shape.

How should I approach this problem?

Store off the linear velocity before destruction, re-create the new object, then apply it again.

I saw this too, but I need both velocity and rotation, not just velocity. I want the new shape to rotate at the same speed that the old shape was.

This should do it -

1 Like

Wow it didn’t occur to me that I could just do newShape.angularVelocity = oldShape.angularVelocity

Thanks for the help. I need more coffee.

Haha, I was making coffee when replying hence the short replies :slight_smile: