Advanced Movement

Blitz3D Forums/Blitz3D Beginners Area/Advanced Movement

GIB3D(Posted 2008) [#1]
Let's say I have a cube, I am using 4 numpad keys 8 and 2 to move it on the Z axis. 4 and 6 to move it on the X axis. This is for a block building type game.

I'm in a 3rd person view and I can move around.

When I am facing forward on the Z axis and am moving the cube forward, everything is fine. But if I move to another side of the cube, say, the left side, and turn to look at it while moving it with the numpad buttons, it becomes very confusing which buttons move it which way.

So what I am asking is,how can I use TForming or AlignToVector to make the X and Z movement for the cube relative to which way I'm facing it? I would do it myself but those two commands are confusing to set up.


Dreamora(Posted 2008) [#2]
aligntovector would be worthless and tform sounds like much more than needed as well.

Use the moveentity command and actually rotate your cube. That way the "z axis" will always be forward / backward and x axis always right / left


GIB3D(Posted 2008) [#3]
Well I'm basing what I'm doing off of the game Blockland. The blocks on there don't need to rotate to move relative to which way you are facing. I need a way to move it without messing it up. Are you sure TForming is too much? Or is there another way?


GIB3D(Posted 2008) [#4]
Here's a way I thought of, that works

I used (EntityYaw(model)/29) to determine which way I'm facing in small increments (-6 to 6) and changed the keyhit()'s accordingly.


Stevie G(Posted 2008) [#5]
I think you're looking for movement relative to the camera. Here's an example I posted a while back which should help ..




GIB3D(Posted 2008) [#6]
:) Something simpler to learn from, thanks.