physics.addBody frustration

Hail marry time.

I have an object that I would like to make a physics object. I am using

[lua]physics.addBody (object, {isBullet = true})[/lua]

This is within a function that spawns a bullet and sends it in a direction via a transition.

This function is called by an object colliding with a specific part of another complex physics body.

If I call the function that spawns the bullet from outside of this type of a collision is works fine, but I cannot think of any reason this should not work.
[import]uid: 102017 topic_id: 18653 reply_id: 318653[/import]

Thats because if your doing a collision related action after a collision you need to add a delay to the function call.

Ie

  
--add my new body  
local function add()  
 physics.addBody(object, {isBullet = true})  
end  
  
--delay adding it and execution of the function  
timer.performWithDelay(2 ,add)  

the delay is 2ms so it will be un-noticeable

Cheers
[import]uid: 84637 topic_id: 18653 reply_id: 71738[/import]