lots of missed collisions firing lasers at targets

Hi,

I’m having a hard time with too many collisions being missed (shots are passing through the target) when firing lasers at targets. 

I get about 30% contact when lasers are fired at a target.  My physics bodies are big enough, I’ve slowed down my shots as much as I can.

when I spawn a shot, this is my physics body:

physics.addBody( torpedo, “dynamic”,   { density = 0, friction =0, bounce = 0, radius=16, isBullet = true})

and for my player:

physics.addBody( player, “dynamic”, { density = .3, friction = .1, bounce = .3, radius = 32 } )

Any thoughts on what is going on?  This is very important to me finishing my game!

Thanks, Greg

Just for giggles, instead of this:

physics.addBody( torpedo, "dynamic", { density = 0, friction =0, bounce = 0, radius=16, isBullet = true})

try this:

physics.addBody( torpedo, "dynamic", { density = 0, friction =0, bounce = 0, radius=16 }) torpedo.isBullet = true

This should be exactly the same, but… I have this weird memory of certain parameters not working as expected unless set after adding the body.

Also, my latter code matches the example here:

https://docs.coronalabs.com/api/type/Body/isBullet.html

I don’t think all physics parameters can be set in the body table (unlike when you use SSK).

Also, you may need to tweak these, depending on how fast the projectiles are moving:

https://docs.coronalabs.com/api/library/physics/setPositionIterations.html

https://docs.coronalabs.com/api/library/physics/setVelocityIterations.html

Thanks Ed, I’ll give it a go!

I set:

physics.setPositionIterations(4) – 3

physics.setVelocityIterations( 10) – 8

That seems to have helped alot, I’ll test further.  Thanks for the suggestion, Greg

Just for giggles, instead of this:

physics.addBody( torpedo, "dynamic", { density = 0, friction =0, bounce = 0, radius=16, isBullet = true})

try this:

physics.addBody( torpedo, "dynamic", { density = 0, friction =0, bounce = 0, radius=16 }) torpedo.isBullet = true

This should be exactly the same, but… I have this weird memory of certain parameters not working as expected unless set after adding the body.

Also, my latter code matches the example here:

https://docs.coronalabs.com/api/type/Body/isBullet.html

I don’t think all physics parameters can be set in the body table (unlike when you use SSK).

Also, you may need to tweak these, depending on how fast the projectiles are moving:

https://docs.coronalabs.com/api/library/physics/setPositionIterations.html

https://docs.coronalabs.com/api/library/physics/setVelocityIterations.html

Thanks Ed, I’ll give it a go!

I set:

physics.setPositionIterations(4) – 3

physics.setVelocityIterations( 10) – 8

That seems to have helped alot, I’ll test further.  Thanks for the suggestion, Greg