Game Development Community

Collision detection

by Waleed · in Technical Issues · 03/01/2007 (12:01 am) · 1 replies

Hi
what the collision detection algorithm that used in torque ?
and how torque can handle the collision detection ?

#1
10/15/2007 (5:23 am)
Function itemname::onCollision()
{


its very simple, heres something i used to make an powerup in my game that increases the players speed:

function TorqueLogoItem::onCollision(%this, %obj, %col)
{
if(%col.getClassName() $= "Player")
{
echo("found strength upgrade");
%obj.delete();

//movement
PlayerBody.maxForwardSpeed += 5.5;
PlayerBody.maxBackwardSpeed += 5.5;
PlayerBody.maxSideSpeed += 5.5;
PlayerBody.maxUnderwaterForwardSpeed += 5.5;
PlayerBody.maxUnderwaterBackwardSpeed += 5.5;
PlayerBody.maxUnderwaterSideSpeed += 5.5;

//jumping
PlayerBody.jumpForce += 3;
PlayerBody.recoverDelay--;
PlayerBody.upMaxSpeed++;
}

}