Game Development Community

Is there a way to check for player movement/rotation?

by Nicolai Dutka · in Torque Game Engine Advanced · 09/08/2009 (5:22 pm) · 3 replies

I am just wondering if there is a way I can check to see if the player is moving or rotating their camera yaw and do something based on the result?

For example:

if($player.isMoving())
echo("Moving!");
else
echo("Stopped moving!");

if($player.isRotating())
echo("Rotating!");
else
echo("Stopped rotating!");

#1
09/08/2009 (5:33 pm)
You can check for moving with VectorLen(%player.getVelocity());
Additional checks can be led out to TS easily if you understand the console reference.
#2
09/08/2009 (5:59 pm)
Will this work with rotations as well? For example, the player is standing perfectly still, but rotating view with the mouse...
#3
09/08/2009 (10:31 pm)
Nope. You'll need to add a console method for that. The Player class's delta struct should help you with finding out how the character is rotating.