Dynamic Bodies

I am sorry if this question has already been addressed. I could not find a solution.

Basically i would like to shrink a body on collision

My code…

local function onCollision( event )

local Phase = event.phase

if (“began” == Phase) then
event.object2.radius = event.object2.radius * 0.5
end
end

It fails because it says radius is a nill value. I am guessing I do not have access to the property.

Has anyone fixed this? I considered removing and creating a new body on collision but that feels yucky.
[import]uid: 43228 topic_id: 8088 reply_id: 308088[/import]

OK, this has been fixed by removing and creating a new image and body.

However, my new images do not seem to be apearing in the correct place.

does anyone have some tried and testing code for removing and creating a new body based on the first?

Cheers [import]uid: 43228 topic_id: 8088 reply_id: 28845[/import]

radius is not a property of any object, AFAIK, even on a circle - it’s only taken when defining.

To recreate an object you’ll have to be careful - are you recreating it in the same display group? [import]uid: 8271 topic_id: 8088 reply_id: 28926[/import]