Game Development Community

Mount and Unmount from Chair Problems

by Britt Scott · in Torque 3D Beginner · 10/27/2012 (7:20 pm) · 2 replies

Problem is I've forgotten the difference between variable types in T3D. I'm thinking that's why the player will mount, but won't unmount.

Also, is mountPose the proper way to play an animation on a non-vehicle shape?

Shape's script:
datablock StaticShapeData(RockingChair)
{ 
	shapeFile = "art/shapes/RockingChair/RockingChair.dae";
	category = "AnimatedObjects";
	className = "RockingChair";
	mountable = true;
	mountPoint = 0;
	numMountPoints = 1;
	mountPose[0] = sitting;
};

function RockingChair::onAdd(%this,%obj)
{
   %obj.playThread(0,"ambient");   
}

Server script:
function RockingChair::onCollision(%this, %obj, %col)
{
   if (%col.getState() !$= "Dead")
   {
      warn("Rocking Chair Collision");
	  %obj.mountObject(%col, 0);
	  %this.schedule(3000, unmount);
   }
   
}

function RockingChair::unmount(%this, %obj, %col)
{
	warn("Player unmount");
	%obj.unmountObject(%col);
	%col.setTransform(%spawnPoint);
}

Thanks!

About the author

Attended Brown College in Mendota Heights, MN for Game Design and Development. Projects include the Mech Starter Kit and the Battle Frog. Currently working toward a game design career.


#1
10/28/2012 (1:06 am)
I think you'll be getting some console errors with this code. Try echoing %obj and %col at the start of unmount and you'll see where the problem is. You need to pass these arguments to the schedule call:
%this.schedule(3000, unmount, %obj, %col);
#2
10/28/2012 (10:23 am)
Thanks, works like a charm.