Game Development Community

Modified mouse cause movment on zaxis wile alt firing.

by George Anderson · in Torque 3D Professional · 12/19/2009 (3:10 pm) · 9 replies

I made some minor modifications to the mouse behavior mostly based on the RTS scripting tutitorial.
Since then when ever I alt fire the Player launches in to the air.

I don't know the source code very well but have found that the movment starts while setting up the spread matrix in rocketLauncher.cs (line 52ish) I don't see the connection that would make the player launch in the torque scripts and don't know the source code well enough yet to know where it might be connected.


#1
12/19/2009 (3:14 pm)
Probably important to mention I am using the following instead of the tutitorials version of toggleMouseLook() and set up a key activated toggle to change which fires off $mvTriggerCount1++; or $mvTriggerCount0++;
So I havent messed with any of the weapon code or movment code

function toggleMouseLook(%val)
{


if(Canvas.isCursorOn())
{
echo("1");
hideCursor();
}
else
{
echo("2");
showCursor();
}

}
moveMap.bind(keyboard, "m", "toggleMouseLook");
GlobalActionMap.bind( mouse, button1, "toggleMouseLook" );
#2
12/20/2009 (6:07 pm)
I dissabled all the script in RocketLauncherImage::onAltFire which is where the movment appears to start in torque script. It made no difference. Also moved the map bind to the keyboard and it didn't make any difference. There is something about $mvTriggerCount1++ that is triggering upward movement.
#3
12/20/2009 (6:32 pm)
Commented out
//jetJumpForce = 830 * 10;
//jetJumpEnergyDrain = 0.6;
//jetMinJumpEnergy = 0.6;
In BoomBot.cs datablock from the tutitorial and the behavior went away.
So somewhere jetJump and altfire are connected.

That is about all I know will update if I find it but not going to actively look for know.
#4
12/21/2009 (4:29 am)
If you have a config.cs file in your script/client folder, delete it.
Because, what is inside config.cs overwrite your mod done into default.bind.cs.
#5
12/25/2009 (7:13 pm)
Yeah thanks for the suggestion. I did that it didn't change anything.
I'm convinced it is not a bound key. I have changed the binding that triggers the $mvTriggerCount1++ tried multiple different modifier keys, even moved it to all keyboard controls and get the same behavior every time.

The final straw:
called this function from the console.

function mouseFire2(%val)
{
$mvTriggerCount1++;
}
and got the same behavior. (helps to point at the ground before doing it so you have a good referance that you are indeed moving.
#6
12/27/2009 (1:12 am)
It's in the Player.cpp file

In ProcessMove(Move) of the Player it checks for JetJump. It's not too hard to find, it's an if statement that also checks a few JetJump parameters as well and is not far after the Jump checks.

The problem is that there is no specific key bound to JetJump in scripts, and in Players.cpp it checks Triggers[1]. That is the exact same key that Alt Fire uses.

The easisest fix for me was to change:

if (move->trigger[1] && !isMounted() && canJetJump())

To:

if (move->trigger[3] && !isMounted() && canJetJump())

since you get up to 6 triggers before modifications anyway.

Then just use $mvTriggerCount3 to use Jet Jumping.

In Short: They are tied to the same key. But the issue is that it's in Code and not scripts, so it takes a little more digging to figure it out. But good news is it's a super simple fix.
#7
01/08/2010 (5:24 pm)
Trigger 3 seems to have become crouch at some point, but it's jet in vehicles. These should really get sorted out in stock so they don't overlap -- if there are 6 triggers available, they shouldn't all need to use the same ones.

0 fire
1 altfire
2 jump
3 jet & jetpack
4 crouch

Or something. :P

Right now we have
0 fire
1 altfire and jetpack
2 jump
3 jet and crouch
#8
01/17/2010 (10:42 pm)
Thanks guys that clears it up.
#9
06/06/2010 (2:50 pm)
Logged as TQA-254.