Makoren
September 21, 2022, 9:25am
1
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.
Solar2D lets you build games/apps for all major platforms including iOS, Android, Kindle, Apple TV, Android TV, macOS, and Windows. Get the free toolset!
Solar2D lets you build games/apps for all major platforms including iOS, Android, Kindle, Apple TV, Android TV, macOS, and Windows. Get the free toolset!
Makoren
September 21, 2022, 9:50am
3
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.
Makoren
September 21, 2022, 9:58am
5
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
system
Closed
March 20, 2023, 10:01am
7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.