Physics Explosion

Posted By: PlaystationThree

Physics Explosion - 01/07/09 11:04

I posted this already in the physics forum but nobody gave any good suggestions so I'm posting again here.

Is there any way to c_scan from a position in the world (i.e. the point of the explosion), then in the entitys' EVENT_SCAN event calculate the distance and direction from the explosion point to my.x, then calculate the correct force that needs to be applied according to the distance then use phent_addcentralforce(); or some other one of those functions to apply it in the right direction. I know there would be lots of trig and vector math involved, and I would figure it out myself, but I'm just starting highschool so obviously haven't learned that yet.
Posted By: Hazardos

Re: Physics Explosion - 01/07/09 13:11

something like this

VECTOR* tmp = vec_position;
vec_sub (tmp, vec_explosion);
vec_length (tmp) //gives now the distance from position to explosion, use this as the force as you want
Posted By: PlaystationThree

Re: Physics Explosion - 01/08/09 00:48

Thanks Hazardos. That's simple enough stuff, but that only give the distance. All the physics functions that add force to an object also need a direction vector in world coordinates, which is what's got me stumped.
© 2024 lite-C Forums