Game Development Community

Manipulate car datablock when collision

by Abdullah Bade · in Torque Game Engine · 10/06/2006 (7:46 am) · 7 replies

I'm trying to increase car speed when it collides with object. Aready went through maxDamage code but its to complicated for begiiner like me.So i really appreciate if someone can show some simple example for me.

#1
10/06/2006 (8:13 am)
The onCollision callback in the vehicle's script would be the best place to do this.
#2
10/06/2006 (8:16 am)
Can you show me an exmple for me? So sorry if its inconvenient for you
#3
10/06/2006 (3:44 pm)
And what if i want it to apply it ti AI vehicle?
#4
10/08/2006 (8:17 pm)
I did change 1 of the datablock properties. But i cant see the effect on my car. Help me solve this plz

function WheeledVehicleData::onCollision(%this,%obj,%col,%vec,%speed)
{
if(%col.getClassName() $="StaticShape")
{
DefaultCar.mass=1000;
echo(DefaultCar.mass);

}
}
#5
10/09/2006 (9:03 am)
Datablocks are transmitted on game connect, and updates are not transmitted. You have to make any property you want to change at runtime, a dynamic propert (not a datablock property).
#6
10/10/2006 (11:15 am)
So, u mean I cant change speed of my car while runtime?, i notice %speed variable, what is that for?
#7
10/10/2006 (11:19 am)
The speed of the impact.