• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
Collision Detection
03-01-2013, 12:34 AM,
Collision Detection
Hello All,

I'm as you can see a noob, and was looking for some pointers...

I'm looking to develop/implement if it has been already a sort of car awareness, such that the car I'm driving knows the distance to surrounding objects, in more specific case the car in front...

So my question is really, has this been done/being done by anyone, or would it be a case of starting from scratch... if so any pointers would be most appreciated...

03-01-2013, 06:08 AM,
 NaN Posting Freak Posts: 2,024 Threads: 120 Joined: Jan 2010
RE: Collision Detection

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.
03-07-2013, 02:14 AM,
RE: Collision Detection

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...
03-08-2013, 03:07 AM, (This post was last modified: 03-08-2013, 03:08 AM by NaN.)
 NaN Posting Freak Posts: 2,024 Threads: 120 Joined: Jan 2010
RE: Collision Detection
VDrift is using metric units internally. The ray callback used in car ai is only reporting the closest contact, it is possible to write one which would return a list of course. The ray length is restricted for performance reasons, bullet is not optimized for ray queries. I haven't benchmarked it though, so it might perform better than I make it sound.
03-13-2013, 09:46 PM,