I'm trying to fire a bullet out of the barrel of a fast moving vehicle's gun barrel. The problem I'm finding is that the bullet's start position appears to lag behind the position of the gun barrel. As the vehicle increases velocity, the bullet's start position lags behind further.
I'm guessing that the problem is that I'm positioning the bullet prior to the timestep getting called, such that the vehicle has already moved forward one step by the time the bullet has appeared on stage (thus creating the lag I'm seeing). Does anyone have an idea on how to address this (or perhaps an alternative idea as to what the problem is)?
So far I did try positioning the bullet after the 'create' function has executed. However, this doesn't seem to work (as I believe manually setting the x,y pos of a dynamic body doesn't work after it's been created... unless it's type is set to 'animated').
I'm guessing that the problem is that I'm positioning the bullet prior to the timestep getting called, such that the vehicle has already moved forward one step by the time the bullet has appeared on stage (thus creating the lag I'm seeing). Does anyone have an idea on how to address this (or perhaps an alternative idea as to what the problem is)?
So far I did try positioning the bullet after the 'create' function has executed. However, this doesn't seem to work (as I believe manually setting the x,y pos of a dynamic body doesn't work after it's been created... unless it's type is set to 'animated').