About Store Forum Documentation Contact
Donations:
392$/mo



Post Reply 
Player movement.
Author Message
Dampire Offline
Member

Post: #1
Player movement.
How to move up player with constant speed. It's need for wallrun. Code, if it possible.
12-16-2009 04:23 PM
Find all posts by this user Quote this message in a reply
Brainache Offline
Member

Post: #2
RE: Player movement.
Vec dir = direction you want to move in...
player.actionMoveDir(dir);

that ought to move the player in a specific dir based on the players speed
12-17-2009 12:34 AM
Find all posts by this user Quote this message in a reply
Dampire Offline
Member

Post: #3
RE: Player movement.
Thnx.
Hmm...
actionMoveDir(ctrl.actor.matrix().y); - player moves to the right
actionMoveDir(ctrl.actor.matrix().z); - player moves forward
actionMoveDir(ctrl.actor.matrix().x); - player moves to the right

Is this normal?
(This post was last modified: 12-17-2009 07:50 AM by Dampire.)
12-17-2009 07:42 AM
Find all posts by this user Quote this message in a reply
Brainache Offline
Member

Post: #4
RE: Player movement.
It would be more like:

Vec dest = some x,y,z coord
Vec pos = chr.pos();
Vec dir = dest - pos;
dir.normalize();
chr.actionMoveDir(dir);

Not sure what the value of your ctrl matrix is... If it was unrotated and normalized... I would expect .y = Vec(0,1,0) .z = Vec(0,0,1), and .x = Vec(1,0,0)...

Which would make .z = move forward, .x = move left, .y = no move since phys wouldnt let him move up...

At least - Thats my thinking - havent tested any of those...
12-17-2009 02:23 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #5
RE: Player movement.
actionMoveDir is for moving on ground plane, its not meant to be used for moving up/down

maybe you could try manually changing the velocities chr.ctrl.actor.vel(Vec(0,1,0))?
I haven't tested this
12-17-2009 04:14 PM
Find all posts by this user Quote this message in a reply
Dampire Offline
Member

Post: #6
RE: Player movement.
Code:
ctrl.actor.gravity(false);
actionMoveDir(Vec(0,1,0));
move up, but set direction to the right...

if only
Code:
actionMoveDir(Vec(0,1,0));
set direction to the right and move to the right.
Hm... Ok, I will work with standart addImpulse(). Thanks.
(This post was last modified: 12-17-2009 04:35 PM by Dampire.)
12-17-2009 04:30 PM
Find all posts by this user Quote this message in a reply
Post Reply