How to mount object onto anotehr object at the collision poin
by Stanley D Chatman · in Torque Game Builder · 11/24/2006 (3:33 pm) · 0 replies
How do you mount a object onto another object making the point of collision the mount point.
here is the code I have so far:
here is the code I have so far:
function planet::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal,%contacts, %points)
{
if ( %srcObject.isCollided == true && %dstObject.isCollided == true )
{
return;
}
//%y = 0 - getWord(%normal,1);
echo("contacts: " @ %contacts);
echo("points: " @ %points);
%dp = getWord(%points,0);
echo("dp: " @ %dp);
echo("dX: " @ %dstObject.getPositionX());
echo("dY: " @ %dstObject.getPositionY());
%lp = %srcObject.getLocalPoint(%normal.getPositionX(),%normal.getPositionY());
%x = getWord(%lp,0);
%y = getWord(%lp,1);
echo("%X: " @ %x);
echo("%Y: " @ %y);
%srcObject.mount(%dstObject, %x, %y, 0, true,true, true, true);
%srcObject.setAutoRotation(0);
%srcObject.setCollisionActive(false, true);
%srcObject.isCollided = true;
%dstObject.isCollided = true;
echo("Planet Collision");
}