Make a prop/entity to ignore forces applied in its surrounding?
2 replies, posted
How can I make an entity to ignore forces that are applied around it?
Think of a missile for instance. Upon initialization, force is applied to the center to make it move forward. During its flight, it may flies into areas where forces are applied to anything within its range (such as a gravity gun jolt). I want a snippt that allows the entity to ignore any unnecessary forces that it encounters throughout its lifetime, but the force that propels it forward remains.
Any ideas? Thanks
[QUOTE=B1N4RY!;22815420]How can I make an entity to ignore forces that are applied around it?
Think of a missile for instance. Upon initialization, force is applied to the center to make it move forward. During its flight, it may flies into areas where forces are applied to anything within its range (such as a gravity gun jolt). I want a snippt that allows the entity to ignore any unnecessary forces that it encounters throughout its lifetime, but the force that propels it forward remains.
Any ideas? Thanks[/QUOTE]
If it's simply a missile that goes forward, you should set its movetype to MOVETYPE_FLY instead of MOVETYPE_VPHYSICS. It's much easier to handle by the engine because it's not physically simulated. It will also completely ignore forces, unless something explicitely changes its velocity.
Then, you control its velocity using Entity:SetVelocity, you don't go through the physics object because there is none. Note that SetVelocity actually adds to the velocity. There is also a velocity limit which is around 4000 if I remember correctly, if you go above it, for some reason, it will stop going straight.
Thanks for the tips, I'll see how it will work out
Sorry, you need to Log In to post a reply to this thread.