Detecting If Vehicle Approaches Person
#1

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:
  • 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
My understanding tells me this should work? Is my understanding of this vector magic incorrect?

Thanks for any help!
Reply


Messages In This Thread
Detecting If Vehicle Approaches Person - by Simon - 03.11.2011, 11:05
Re: Detecting If Vehicle Approaches Person - by CyNiC - 03.11.2011, 12:15
Re: Detecting If Vehicle Approaches Person - by Simon - 03.11.2011, 20:00
Re: Detecting If Vehicle Approaches Person - by Simon - 06.11.2011, 06:16
Re: Detecting If Vehicle Approaches Person - by Kar - 09.06.2013, 18:55

Forum Jump:


Users browsing this thread: 2 Guest(s)