.:HyPeX:. Posted May 3, 2014 Share Posted May 3, 2014 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
tosfera Posted May 3, 2014 Share Posted May 3, 2014 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? Link to comment
.:HyPeX:. Posted May 3, 2014 Author Share Posted May 3, 2014 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
.:HyPeX:. Posted May 3, 2014 Author Share Posted May 3, 2014 setElementCollisionsEnabled Read correctly, that will make it static, i dont think it will be able to move at all then.. Link to comment
tosfera Posted May 3, 2014 Share Posted May 3, 2014 setElementCollisionsEnabled Read correctly, that will make it static, i dont think it will be able to move at all then.. Whoops, copied the wrong one. My bad, it should've been SetElementCollidableWith ^^". Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now