How to change shape of Object

Hello Guys,

How to change Object shape as shown

This body need to be Dynamic

Thanks in advance

You can’t change the shape of physics bodies. What you can do is remove them and add a new one. What I suspect you want to do is have two welded together, one square and one circular. Make one a sensor and the other not, then to change shape switch them round.

Note: what you’re showing is a changing texture, not a changing physics body.  (Although, it is probably implied that the body shape would need to change.)

You would change the visual aspect by changing the texture used or using a sprite and changing the current animation.

You would change the physics body representing the new shape by replacing it as already noted by @horacebury

I think hiding and unhiding should help

say you have two objects circle and square

when you tap on circle then set circle.isvisible=false and square.isvisible=true and vice versa

This will not work because if the body is hidden or not hidden it get the effect by physics.

You can’t change the shape of physics bodies. What you can do is remove them and add a new one. What I suspect you want to do is have two welded together, one square and one circular. Make one a sensor and the other not, then to change shape switch them round.

Note: what you’re showing is a changing texture, not a changing physics body.  (Although, it is probably implied that the body shape would need to change.)

You would change the visual aspect by changing the texture used or using a sprite and changing the current animation.

You would change the physics body representing the new shape by replacing it as already noted by @horacebury

I think hiding and unhiding should help

say you have two objects circle and square

when you tap on circle then set circle.isvisible=false and square.isvisible=true and vice versa

This will not work because if the body is hidden or not hidden it get the effect by physics.