Jump to content
Sign in to follow this  
Big Dawg KS

CreateVehicle + SetVelocity = delay

Recommended Posts

We all know that it can take some time for createVehicle'd objects to have their physics enabled. Usually it's not an issue, however it's causing some greif for me.

What I need to do:

CreateVehicle(Local) an object and immediately give it a velocity.

Problem:

Object "sticks" in place for a second or two (can vary) before the setVelocity kicks in.

Has anyone else faced such problems, and if so have you found a solution that allows you to instantly get the velocity on the created object? Please note: the object I'm trying to create is just for visual effect, it need only be seen and while I would like it to collide, it doesn't have to.

Share this post


Link to post
Share on other sites

Well, i had a similar trouble with a with an empty shell ejecting out of a canon. So i createvehicle the shell at [0,0,0] coordinates, so that nobody sees it not moving, then setpos + setvelocity where it is supposed to be ejected.

But it may not be exactly your own trouble.

Share this post


Link to post
Share on other sites

Acutally, it's pretty much exactly my scenario. The object I am creating is an empty cartridge. The solution you mentioned; if I understand you correctly you mean you wait a bit (for physics to kick in) and then setPos + setVelocity on it? I'd prefer something that works instantly from called (engine suspended) code, but if I have to put in a delay I suppose it is possible if I use some sort of workaround using attachTo so that by the time the physics kick in, the cartridge will still be emitted from the correct position and in the direct direction relative to the source (vehicle with a turret).

Share this post


Link to post
Share on other sites
Gnat;1662705']Does preloadObject help at all ?

Interesting. I'm not sure exactly how it works, nor how I could use it to solve this problem.

Do you have any clue how it might be used in this situation?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×