The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "lockoutexpiry" - Line: 94 - File: global.php PHP 8.1.31 (Linux)
|
Collision Detection - Printable Version +- Forums (https://www.vdrift.net/Forum) +-- Forum: Project (https://www.vdrift.net/Forum/forumdisplay.php?fid=4) +--- Forum: Development (https://www.vdrift.net/Forum/forumdisplay.php?fid=9) +--- Thread: Collision Detection (/showthread.php?tid=1698) |
Collision Detection - Linksblackmask - 03-01-2013 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... Thank you in advance, any advice would be golden RE: Collision Detection - NaN - 03-01-2013 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. RE: Collision Detection - Linksblackmask - 03-07-2013 (03-01-2013, 06:08 AM)NaN Wrote: Hi Linksblackmask 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... RE: Collision Detection - NaN - 03-08-2013 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. RE: Collision Detection - Linksblackmask - 03-13-2013 Its not honestly that intensive, I had it do five rays at max of 1000 and no noticeable game proformance was seen, however I'm not expert so... I just checked FPS... But thank you very much anyways |