Reset Body Without Removing....?

Quick question, I have searched though the API list but not found a definitive answer.

Basically all I want to know is how to reset ALL of the properties of a physical body, ie its velocity, angle, rotation etc. So by reset I mean restore it to it’s initial state as it was when it was initially created.

Thank you [import]uid: 6981 topic_id: 4217 reply_id: 304217[/import]

EDIT : Nevermind.

For anyone else wondering about this here is what needs to be done :

myObject:setLinearVelocity(0, 0)
myObject.angularVelocity = 0
myObject.rotation = 0 [import]uid: 6981 topic_id: 4217 reply_id: 13109[/import]

that won’t reset it’s world position though.

you didn’t specify exactly what you wanted to reset, or that you werent creating with properties other than 0…

but it appears you’ve solved your problem anyway

[import]uid: 6645 topic_id: 4217 reply_id: 13126[/import]

Yeah i reset its world position also. I should have specified that also :slight_smile: [import]uid: 6981 topic_id: 4217 reply_id: 13127[/import]

what type is the body? kinematic?

i had problems changing x,y on a dynamic object i think [import]uid: 6645 topic_id: 4217 reply_id: 13237[/import]

I’m also curious how to reset everything in the game level, like when I push a retry button. [import]uid: 32061 topic_id: 4217 reply_id: 23777[/import]

It depends on how much of a reset you want. If your moving between different modules i.e.

game --> retry --> game

then you may just want to remove everything in the game module, then switch to the retry module, then remove everything in the retry and go back to the game module. [import]uid: 10903 topic_id: 4217 reply_id: 23915[/import]

So the only way to reset all bodies in a game level would be to exit the screen, and then go back to the screen?

I have a retry button that I want to reset every object to its original state as if entering the screen for the first time. [import]uid: 32061 topic_id: 4217 reply_id: 24448[/import]

I’m trying to reset my game also. Does anybody know how to do this? I tried to use director class and just transition to the same screen I was on and that didn’t work. I know the button itself is working right because when I put a different screen to change to it works.

Any suggestions. I just want to start the game over and there are not levels to this game. Just one screen that I want to restart after a failure or a completion of the game. [import]uid: 72372 topic_id: 4217 reply_id: 46948[/import]