Only move backwards
by John Coyne · in Torque Game Engine · 07/24/2005 (3:56 pm) · 2 replies
I'm just trying to build a little demo like chapter 4 of the ken finney book (except i'l have a different camera and use the left/right keys to "steer" rather than strafe).
Anyway, for some reason the player can only move backwards. I Know the move functions are getting called cos of the echo statements in them.
Does anyone have any idea whats going on?
---------------------------------
//control/client.cs
if (isObject(playerKeymap))
playerKeyMap.delete();
new actionMap(playerKeymap);
$movementSpeed = 1;
new GameTSCtrl(playerInterface)
{
profile = "GuiContentProfile";
noCursor = "1";
};
function playerInterface::onWake(%this)
{
$enableDirectInput = "1";
activateDirectInput();
playerKeymap.push();
}
function GameConnection::InitialControlSet(%this)
{
canvas.setContent(PlayerInterface);
}
function goFoward(%val)
{
echo("going foward " @ %val);
$mvFowardAction = %val;
}
function goBackward(%val)
{
echo("going backward " @ %val);
$mvBackwardAction = %val;
}
function leftTurn(%val)
{
echo("turning left " @ %val);
$turnLeft = %val;
}
function rightTurn(%val)
{
echo("turning right " @ %val);
$turnRight = %val;
}
function doYaw(%val)
{
$mvYaw += %val * ($cameraFOV / 90) * 0.02;
}
function doPitch(%val)
{
$mvPitch += %val * ($cameraFOV / 90) * 0.02;
}
function toggle1stPPOV(%val)
{
if(%val)
{
$firstPerson = !$firstPerson;
}
}
playerKeymap.bind(keyboard, up, goFoward);
playerKeymap.bind(keyboard, down, goBackward);
playerKeymap.bind(keyboard, left, leftTurn);
playerKeymap.bind(keyboard, right, rightTurn);
playerKeymap.bins(keyboard, z, dropCam);
playerKeymap.bind(mouse, xaxis, doYaw);
playerKeymap.bind(mouse, yaxis, doPitch);
playerKeymap.bind(keyboard, tab, toggle1stPPOV);
globalActionmap.BindCmd(keyboard, escape, "", "quit();");
globalActionmap.bind(keyboard, tilde, ToggleConsole);
-----------------------------------
Anyway, for some reason the player can only move backwards. I Know the move functions are getting called cos of the echo statements in them.
Does anyone have any idea whats going on?
---------------------------------
//control/client.cs
if (isObject(playerKeymap))
playerKeyMap.delete();
new actionMap(playerKeymap);
$movementSpeed = 1;
new GameTSCtrl(playerInterface)
{
profile = "GuiContentProfile";
noCursor = "1";
};
function playerInterface::onWake(%this)
{
$enableDirectInput = "1";
activateDirectInput();
playerKeymap.push();
}
function GameConnection::InitialControlSet(%this)
{
canvas.setContent(PlayerInterface);
}
function goFoward(%val)
{
echo("going foward " @ %val);
$mvFowardAction = %val;
}
function goBackward(%val)
{
echo("going backward " @ %val);
$mvBackwardAction = %val;
}
function leftTurn(%val)
{
echo("turning left " @ %val);
$turnLeft = %val;
}
function rightTurn(%val)
{
echo("turning right " @ %val);
$turnRight = %val;
}
function doYaw(%val)
{
$mvYaw += %val * ($cameraFOV / 90) * 0.02;
}
function doPitch(%val)
{
$mvPitch += %val * ($cameraFOV / 90) * 0.02;
}
function toggle1stPPOV(%val)
{
if(%val)
{
$firstPerson = !$firstPerson;
}
}
playerKeymap.bind(keyboard, up, goFoward);
playerKeymap.bind(keyboard, down, goBackward);
playerKeymap.bind(keyboard, left, leftTurn);
playerKeymap.bind(keyboard, right, rightTurn);
playerKeymap.bins(keyboard, z, dropCam);
playerKeymap.bind(mouse, xaxis, doYaw);
playerKeymap.bind(mouse, yaxis, doPitch);
playerKeymap.bind(keyboard, tab, toggle1stPPOV);
globalActionmap.BindCmd(keyboard, escape, "", "quit();");
globalActionmap.bind(keyboard, tilde, ToggleConsole);
-----------------------------------
About the author
#2
Thanks, can go foward now, i mean forward ;)
Still cant get the player turning left and right with the keys though :( (looks for spelling errors).
Now i think of it, the racing starter kit lets you steer with the keys, i'll take a look at that.
nm. got the turning working now :D
07/25/2005 (4:29 am)
An I-D-ten-T error then *blushes*Thanks, can go foward now, i mean forward ;)
Still cant get the player turning left and right with the keys though :( (looks for spelling errors).
Now i think of it, the racing starter kit lets you steer with the keys, i'll take a look at that.
nm. got the turning working now :D
Torque Owner Gary "ChunkyKs" Briggs
Normally, it wouldn't make much odds, except in this case "$mvFowardAction" is getting set; torque elsewheres is probably seeking "$mvForwardAction"
Gary (-;