List of physics properties to record when cloning

I am trying to clone a physics body. Most properties in a physics body, such as category / collision / contact bit masks, mass, shape etc are unchanging and can simply be recreated the same way the original physics body was created, whether it is by using some template / tool like physics editor or otherwise.

The tricky things I have identified which would vary based on game state, and which should be explicitly recorded are:

velocity
angular velocity
rotation offset
moment

Is that correct ? Are there any other physics properties that I need to keep a record off ? If you have cloned physics objects before, please chime in with your suggestions etc, or things I need to add to the list.

Perhaps @stevetranby @OrionSteel @panor have additional thoughts…

I’m guessing you’d need to copy material properties too, like mass, friction, static/dynamic. But why not just copy “everything”?
Look at all the get/setters for body - use each pair.

1 Like

Thats a good idea (looking at the getters setters) - The reason I don’t copy everything is because I can load somethings through a template generated from PhysicsEditor - Things like mass, friction etc don’t change throughout the lifetime of the object and are the same for all objects of a given type, so I can create a clone of those properties simply by loading the template (one line of code).

During gameplay, the properties that seem to change dynamically are things like velocity etc - those are things which specifically I need to query the object when creating a clone.

If it helps anyone else, the properties that I identified that one specifically needs to write code for / which are more likely to change compared to a template generated from PhysicsEditor are:

velocity
angular velocity
rotation offset
moment