Change physics body shape during code execution?

I created a physics body with a sprite sheet and a custom rectangular shape. I would like to make the shape smaller by 1/2. Is this possible? I tried the scale property but it only scales down the visible image (sprite) and it won’t let me re-assign the shape coordinates.
Thanks. [import]uid: 39031 topic_id: 17088 reply_id: 317088[/import]

The easiest way of actually doing this is removing the physical body and re-adding it. Is that an option here? (This is because of box2d limitations.) [import]uid: 52491 topic_id: 17088 reply_id: 64208[/import]

Hey, Peach.

I managed to shrink the object by removing and adding the entire object although it wasn’t as easy I thought it would be because the obj was in the middle of collision.

I do have one related question.

If I assign a physics object to a variable, remove the object but don’t do anything to the variable, add a new physics object and assign it to the same variable, does this create a new variable or store new physics object to the existing variable?
In other words, can two variables with the same name exist (regardless of local or global)?

Thanks for your help as always! [import]uid: 39031 topic_id: 17088 reply_id: 64412[/import]

Hey there, glad to hear it.

As to your question, can two variables with the same name exist? No.

If you said;
[lua]local myVar = 10
myVar = 20[/lua]

Despite one being local and the other not, myVar would also equal the second value in that example. (Even if you switched them around, etc.)

Make sense?

Peach :slight_smile: [import]uid: 52491 topic_id: 17088 reply_id: 64443[/import]

Sounds good, thanks!!
Until next time~ [import]uid: 39031 topic_id: 17088 reply_id: 64781[/import]