Game Development Community

Player Transform

by Kurt · in Torque Game Engine · 05/07/2003 (8:21 am) · 8 replies

Is there a way to modify the player's transform in the engine such that Y is up so that when the up arrow is pressed the player moves up instead of forward?

Thanks

#1
05/07/2003 (8:26 am)
you could do this in script (the following will give you an example how to remap the "w" key, which could be used to map the up arrow key)

look at example\fps\client\scripts\default.bin.cs

you could change the following

moveMap.bind( keyboard, w, moveforward );

to

moveMap.bind( keyboard, w, moveup);


-Ron
#2
05/07/2003 (8:49 am)
I kind of want to do this on the fly. I am trying to implement ladders. My thoughts were:

1.) Have a trigger at the bottom of the ladder( DTS object with collision mesh ) and when the player hits the trigger his bounding box transform is rotated such that forward is up.

2.) Have a trigger at the top of the ladder that resets the transform so that he moves forward again.

Maybe I am way off in this thinking.

Kurt
#3
05/07/2003 (8:57 am)
hrmm..

how about a trigger that could swap the bind on w to move up, set the annimation accordinfly and once at the top another trigger to play an annimation where player pulls self up and onto roof top, stops annimation and swaps keybind back?

-Ron
#4
05/07/2003 (9:08 am)
Okay, forgive my ignorance, but by default can the player move up or do I have to unlock him so that he can move in the z direction. BTW, this looks promising.


Kurt
#5
05/07/2003 (9:13 am)
That I can not answer, have not played with that aspect of the engine before.

-Ron
#6
05/07/2003 (9:39 am)
Okay, so i think I am going to need to learn how to unlock the player such that he can move in the z direction. I looked at the jetpack resource but this delas with acceleration that doesn't really apply to being on a ladder. Hopefully I can come up with something.

Thanks,

Kurt
#7
05/07/2003 (9:45 am)
What I'd do is this:

When the player hits the trigger, call a C++ function that changes his state.

So, when he's climing make his MoveState = Climb;
But, when he's moving make his MoveState = Forward;

Then, in the Player::updateMove(..) when you process the Y input from the keyboard

move->y I believe, check to see if his MoveState is Climb or Forward, and depending on which one it is, alter his position accordingly.
#8
05/07/2003 (9:59 am)
I kind of do that now like so (psuedo code):

if( climbing )
{
move.z += difference in last y movement
}

The problem is gravity. I want him to be able to stop on the ladder. I guess i could just disable gravity.