Game Development Community

Point of collision

by Roshan Kuriyan · in Torque Game Engine Advanced · 07/09/2006 (9:31 pm) · 9 replies

Hai all
When my vehicle is colliding with anything i need the point or world coordinates where it is colliding.
Is there any command to get it.
thanks in advance

#1
07/10/2006 (9:38 pm)
I am developing a car race demo.
when my vehicle collides with other vehicles or a dif i want fire sparks at the portion
where its colliding.I able to create sparks with particle emmiter,but could not place
it in the exact point of collision. Could any one tell how to get that point where its colliding.
Thanks
#2
07/10/2006 (11:38 pm)
The vehicle generates a list of collision points when it does its physics. Grab the list, choose points, emit sparks.
#3
07/11/2006 (12:32 am)
R u specifying the buildpolylist function
or is there any function to get the list of collision points
#4
07/11/2006 (2:33 pm)
Look over bool Vehicle::updateCollision(F32 dt) - in general, if you take a few hours to read through ALL the vehicle code and take some notes, you'll find that you'll a) have a good idea what's going on in there, or at least a better one and b) know where everything you want is.

We can write all the docs in the world but sometimes the easiest thing to do is just read over the source. ;)
#5
07/13/2006 (8:08 pm)
Thanks ben
I thought there would be some resources or script level console commands to get the
collision coordinate
#6
07/13/2006 (9:17 pm)
There's an onCollision call back for some objects - maybe that has what you want?
#7
07/14/2006 (7:37 pm)
Vehicle onCollision call back function is as follows

function WheeledVehicleData::onCollision(%this,%obj,%col,%vec,%speed)

%this - client object that calls this function
%obj - objects that collides
%col - object recevies to the collision
%speed - speed of the %obj on collision
what dose %vec
It returns some 3Fpoint value
Will that hepl me in any way
#8
07/14/2006 (11:04 pm)
%this is the datablock of the vehicle being collided with.

%vec is the relative velocity of the two objects.

If you look at updateCollision and resolveContacts you'll see there is a CollisionList being passed in - which contains an array of the Collision structure, which contains a pointer to the colliding object, as well as the point and normal of the collision point!

If you go to Vehicle::processTick, around line 646 of vehicle.cpp or so is a pretty good spot to add something to loop over mCollisionList and issue a callback.
#9
07/17/2006 (6:59 pm)
Thanks a lot Ben , it works fine .
here is how v found .
in vehicle.cpp u can find a for loop for the colision points near 1658 line no . we took those points and added to the emiter point of the dust particle effects , removed the offset points .in the line no 1546.
now when vehicle on colloid dust will appear on the point of collision .

thanks u