Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / Getting collision data with vehicles

Author
Message
Richaldo
14
Years of Service
User Offline
Joined: 12th Nov 2009
Location: Hertfordshire, England
Posted: 3rd Dec 2009 23:52
I'm trying to write some code that will return the contact point and force of a collision between a vehicle and another object.

I'm able to get all the collisions, including ones with vehicles, using the dbPhyGetCollisionData function, but for some reason the dbPhyGetCollisionContactPoint and dbPhyGetCollisionNormalForce functions only ever return zero values when the collision involves a vehicle despite returning proper values when the collision is between other static and dynamic objects.

Do these functions simply not support vehicle collisions, or am I doing something wrong?

Any info greatly appreciated!
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 5th Dec 2009 00:03
dbPhyGetCollisionNormalForce doesn't work...

I save the position of my objects each loop to get their velocity:

Do this at the end of each loop...


and this when you "get collision data"...



sorry if it's not very obvious but I've had a few ales...
Richaldo
14
Years of Service
User Offline
Joined: 12th Nov 2009
Location: Hertfordshire, England
Posted: 7th Dec 2009 00:17
Thanks for your help with the velocity. It certainly makes sense that its possible to calculate the velocity of impact manually. I'm not at my dev PC now, but I will try this later in the week.

I'm guessing dbPhyGetCollisionContactPoint also doesn't work for vehicles? Is there any way round this as I need to know where the collision occured on the vehicle (either in world or local coords) so I can apply appropriate damage effects.

Is it possible to assign a collision object to a vehicle to get this information or is there another way?

Thanks in advance
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 7th Dec 2009 09:49
Quote: "I'm guessing dbPhyGetCollisionContactPoint also doesn't work for vehicles? Is there any way round this as I need to know where the collision occured on the vehicle (either in world or local coords) so I can apply appropriate damage effects."

Not sure about "dbPhyGetCollisionContactPoint" not working but if so you could always get the collision point from the other object or maybe do a check for the closest vertex to the other object using the "GET VERTEXDATA" commands...

Quote: "Is it possible to assign a collision object to a vehicle to get this information or is there another way?"

If you are using the DarkPhysics vehicle then I don't think so as the vehicle would collide with this object too... I often use a "Dummy" physics object for characters and vehicles but normally when I'm controlling them manually.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 7th Dec 2009 12:54
if I remember right the collision date is taken from the dbPhyAddVehicleBody so if it too big or too small you do not get the response you require.

which beacuse of they way it works, does not return data you think it should.
if you were using the command as it is in Nvidia physX with actors the size of the vehicle is w/2,h/2,d/2. however in my testing of this command dbPhyAddVehicleBody it works differently.

its more d/2,h/2,w/2 , this what I've found out, hope this of some help.

Dark Physics makes any hot drink go cold.
Richaldo
14
Years of Service
User Offline
Joined: 12th Nov 2009
Location: Hertfordshire, England
Posted: 7th Dec 2009 22:27
Thanks for the help guys!

It seems as though I've finally got both dbPhyGetCollisionContactPoint and dbPhyGetCollisionNormalForce to work with vehicles.



The above code seems to be returning a useful values now where appropriate so I shall continue with my experiments and let you know if I find out anything else. I think my problem before was that I was passing in obj_a as the first parameter instead of obj_b.

I'm not sure exactly what the second parameter is for, but zero seems to work for me. Does anyone know what purpose this serves and why you may want to change it from zero?
Duke E
15
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 8th Dec 2009 03:59 Edited at: 8th Dec 2009 04:04
The extra parameter is there so you can interate multiple contact points. Physix saves many collisions per object for a collision data event not only one. As an object can for instance roll on the ground and hit a wall at the same time.

Here is some code that explains it, in DBP but should be clear enough for the GDK conversion. Any Phy collision command that takes the collision instance parameter can be substituted:



Regards

Login to post a reply

Server time is: 2024-04-19 11:43:54
Your offset time is: 2024-04-19 11:43:54