Question: Changing body's radius after created

Hey everybody and thanks in advance to all the helpers :slight_smile:

I wanted to know if there’s an option to change a body’s radius of collision after it’s already exist ?

No, not directly.

If you’re willing to do the leg work, you can remove the body and add it again.

The leg work is to make sure that you disconnect and reconnect all the joints etc. This will include resuming the forces and possibly a lot of other things.

Create some test code to see what you might forget about and really test it out. I recommend trying to figure out another way, because this can get hellish real quick.

I speak from experience.

Ok, thank you.

Can I remove a body without removing the display object ?

Yes

http://docs.coronalabs.com/api/library/physics/removeBody.html

Also note that if you “can’t” remove and re-add the body – for example, the object must continue moving on its exact same trajectory and it essentially can’t be interrupted in any way – you could construct the body using multiple body elements and then use pre-collision handling to detect which element(s) are “active” and which should be ignored. It’s more complex to set up and handle, of course, but if you need it, the option is available to you.

Brent

No, not directly.

If you’re willing to do the leg work, you can remove the body and add it again.

The leg work is to make sure that you disconnect and reconnect all the joints etc. This will include resuming the forces and possibly a lot of other things.

Create some test code to see what you might forget about and really test it out. I recommend trying to figure out another way, because this can get hellish real quick.

I speak from experience.

Ok, thank you.

Can I remove a body without removing the display object ?

Yes

http://docs.coronalabs.com/api/library/physics/removeBody.html

Also note that if you “can’t” remove and re-add the body – for example, the object must continue moving on its exact same trajectory and it essentially can’t be interrupted in any way – you could construct the body using multiple body elements and then use pre-collision handling to detect which element(s) are “active” and which should be ignored. It’s more complex to set up and handle, of course, but if you need it, the option is available to you.

Brent