(03-01-2013, 06:08 AM)NaN Wrote: Hi Linksblackmask
VDrift is using bullet physics lib. So you can use any method for object queries offered by it. For more specific examples you can look into car ai code. The experimental ai(ai/ai_car_experimental.cpp) is using a ray to check whether there is a fixed obstacle in front of it. It is using the castRay function meant for the wheels, could be simplified by using bullets ray cast call directly(see castRay implementation).
If you don't require exact information or are concerned about ray cast performance, you can calculate the distance to the surrounding cars(their center of mass) along your forward vector. I think this code is there for braking calculation, but is disabled.
Hay NaN,
Thanks for the answer
, have looked into the ai_car_experimental, and have a few more questions, if you wouldn't mind...
Firstly, what unit of measurement does Vdrift use, I assume feet?
Secondly, when calling RayCastDistance to detect distance, is that only to fixed objects (assuming here, walls etc) or (what I think it to be) is that any object including other AI cars?
See I'm "simply" (dont really know how simple it is...) trying to obtain distance from the front of my car to the nearest object, be it a wall or nearest car, I can see that RayCastDistance has the functionality for me to do this already, providing ofcourse I pass, it MATHVECTOR and max_length; but I want the max_length to sort of be like 5280ft/1mile so that is do return the closest object. Hence my two Q's...