Hi I am trying to create a game with a 3RD person perspective. I have the camera system worked out now I'm fine tuning it.
What I wanted to know is how do I get a scene node to move forward(local translations) or strafe?.
Thanks .
Character movement.
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
Character movement.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Re: Character movement.
Have you tried searching the forums a bit? I know I've seen quite a few threads on this in the past. More specifically the "Code Snippets" section.3DModelerMan wrote:Hi I am trying to create a game with a 3RD person perspective. I have the camera system worked out now I'm fine tuning it.
What I wanted to know is how do I get a scene node to move forward(local translations) or strafe?.
Thanks .
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
HMMMMM
Yeah I searched... maybe if someone could just point me to one of the threads?.
Thanks.
Thanks.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
lol... where did you search? xD
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=27781
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=27741
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=26989
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=7977
and it is just the first page xD
check code snippets and FAQS xD
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=27781
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=27741
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=26989
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=7977
and it is just the first page xD
check code snippets and FAQS xD
-
- Competition winner
- Posts: 189
- Joined: Tue Oct 16, 2007 3:53 am
- Location: Indonesia
- Contact:
this is a movement code that relative to camera position, but it's need alot of modification to use on your case. i use gamepad to move my character, that is why i can get the x_axis ( signed integer ) and y_axis ( signed integer ).
Code: Select all
// whatever condition u use for moving u're node
if(((input->x_axis>300) ||
(input->x_axis<-300)||
(input->y_axis>300) ||
(input->y_axis<-300))&&
(input->action==TPS_IDLE)){
// direction you dizire from input
f32 floatDeg = atan((f32)input->y_axis/(f32)input->x_axis)*RADTODEG;
vector3df rotation = vector3df(-90,floatDeg,0);
//set up rotation vector from camera position and the node position
f32 camRot = (camRefPosition-node->getPosition()).getHorizontalAngle().Y+90;
rotation.Y+= camRot;
rotation.Y-= node->getRotation().Y;
rotation.X = 0;
rotation.Z = 0;
//rotate your node, if strave dont rotate it
node->setRotation(node->getRotation()+rotation);
//move your node---->
if(input->useRunSpeed){
input->accelerate = 2;
}else{
input->accelerate = 1;
}
}else{
input->accelerate = 0;
}
if(input->accelerate>0){
switch(input->accelerate){
case 1:
walk();
break;
case 2:
run();
break;
case 3:
stepBack();
break;
}
}else{
idle();
}
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
thanks
Thanks that's probably going to work.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
use camera parameters. Apply transformations to the player's position based on where the camera is facing (the direction vector. You can ignore the 3rd dimension if you don't want the player to move up and down). Strafing is done in a 90 degree angle so do a dot product or something (forgot math you can look it up) and then apply that transformation vector to node's position.
Thats how I used to do it.
Thats how I used to do it.
---------
I'm on your side.
---------
I'm on your side.
---------