Jump to content

Car first?


Recommended Posts

Hey guys, how could i know if a car is ahead of another one? Lets say:

car A is facing north, and car B is also facing north.

car A is 10 units more to the north than car B.

Therefore, car A is ahead.

But i i get that previously car A was ahead, and now car B is ahead (eg. car A is 10 units to the south of car B, but still pointing north), how could i get this? its not simple distance between 2 elements, it should also consider Z rotation. is there any function for this?

Becouse if car A decided to turn arround and go the other way, car B shouldnt be going to be ahead, he's behind car A, since he has to turn arround to catch him.

PD: to make it closer, i'm trying to recreate a NFS:Underground 2 game mode where you had to chase a car, pass it, and leave it behind. (loose it)

Link to comment
Maybe a random guess, but what if you attach a colshape to vehicle B, and see if there are vehicles in it, and if so check its position? :)

Its the same as doing a distanceBetweenTwoPoints, i guess i'll have to do some maths about rotations..

Another thing, how can i disable collisions within vehicles?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...