03.11.2011, 11:05
Code!
Hey,
With this code above I'm trying to see if a velocity vector will intersect with a players position. I want to be able to detect if somebody is driving at a player when they press KEY_FIRE, however, this does not appear to work at all by doing the following steps:
Thanks for any help!
Hey,
With this code above I'm trying to see if a velocity vector will intersect with a players position. I want to be able to detect if somebody is driving at a player when they press KEY_FIRE, however, this does not appear to work at all by doing the following steps:
- Normalize the velocity vector so it has length 1.0
- Get the distance between the vehicle and the player
- Multiply the velocity vector to be that length
- Calculate a projected point by adding the scaled velocity vector to the vehicles position
- Finally, check if the projected point is in range of the player
Thanks for any help!