Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tracking Car Collisions
03-20-2010, 02:22 PM,
#1
Tracking Car Collisions
Hi, I'm doing a research in affective game based learning and I want to pool collisions (with surface, car to car, and with walls) to an external analyzer. After scanning through game.cpp I could locate the following methods,
UpdateCarChassisCollisions()
UpdateCarWheelCollisions(...)
UpdateCarWheelCollisionsWithSurfaces(...)
UpdateCarWheelCollisionsFromCached(...)
UpdateCarWheelCollisionsFromCachedWithSurfaces(...)

Next after some experiments I inserted my code segment as follows,

UpdateCarChassisCollisions() {
...
if (carcontrols_local.first == &car) isColChassis = true;
...}

UpdateCarWheelCollisions(...) {
...
if (carcontrols_local.first == &car) isOnTrack = true;
...}

UpdateCarWheelCollisionsWithSurfaces(...) {
...
if (carcontrols_local.first == &car) isColSurface = true;
...}

isOnTrack works perfectly and it gives whether the car is on the track or not. isColChassis gives about car to car and wall collisions, but doesn't work perfectly. No effect in isColSurface.
The purpose of the other two methods is unclear to me.

Someone please explain me how to get these collision information correctly.

Thanks in advance.
Reply
03-20-2010, 03:43 PM,
#2
 
Hi hiran.

UpdateCarChassisCollisions()
Check for dynamics objects(cars) collisions.
Code:
collision.CollideDynamicObjects(cartocarcollisions);
Set contacts (contact is processed in CARDYNAMICS:TonguerocessContact if cars are not separating v * n > 0).
Code:
car.SetDynamicChassisContact
Iterate through cars and check for collisions with the track geometry..
Code:
collision.CollideObject(car.GetCollisionObject(), contactlist, settings);
Set contacts.
Code:
if ((colpt - colcenter).dot(normal) <= 0)
                    car.SetChassisContact(colpt, normal, depth, collision_rate);
So you have to watch for SetDynamicChassisContact and SetChassisContact to set isColChassis.

UpdateCarWheelCollisions(...)
Wheel ray vs track bezier patch followed by ray vs track geometry.
If (beziercol) the wheel is on track. If (!contactlist.empty()) wheel might collide with track geometry (doesn't mean that there is a contact).

UpdateCarWheelCollisionsWithSurfaces(...)
Can't comment on this one. I think it was merged into UpdateCarWheelCollisions(). What rev are you using?

UpdateCarWheelCollisionsFromCached(...)
Interpolate wheel contact points. Not very interesting for you I think.
Reply
03-22-2010, 07:04 AM,
#3
 
Hi, Thanks. I was using a rev few months old, but now I've upgraded it to the latest rev and it worked as expected.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)