Game Development Community

WheeledVehicle dismount issue

by Travis Vroman · in Torque Game Engine · 02/09/2003 (8:30 am) · 1 replies

I got the vehicle so it would allow me to dismount. However, when the player dismounts, he winds up stuck in the bounding box, and then mounts again in a few seconds. How do I fix this?

-Travis 'Barzahd' Vroman

#1
02/09/2003 (8:37 am)
easy .. in the player.cs file
in the doDismount(..) function.
the section controlling dismounting also controls direction of dismount and force applied

here is some hacker code for a driver side dismount:
// Position above dismount point
	%pos    = getWords(%obj.getTransform(), 0, 2);
	%oldPos = %pos;
	%vec[0] = " -1  0  0"; // Driver Side Exit
	%impulseVec  = "-1 0 0"; // Impulse to the Left of Vehicle
	%vec[0] = MatrixMulVector( %obj.getTransform(), %vec[0]);
	// Make sure the point is valid
	%pos = "0 0 0";
	%numAttempts = 1;
	%success     = -1;
	for (%i = 0; %i < %numAttempts; %i++)
	{
		%pos = VectorAdd(%oldPos, VectorScale(%vec[%i], 3));
		if (%obj.checkDismountPoint(%oldPos, %pos)) 
		{
			%success = %i;
			%impulseVec = %vec[%i];
			break;
		}
	}
	if (%forced && %success == -1)
		%pos = %oldPos;

(I was lazy and just wanted a driver side dismount this needs to be cleaned up)
Edit:
haha Lookin at this code now .. looks funny it Really needs to be cleaned up :)