You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers. No questions about C++ programming or topics which are answered in the tutorials!
Okay I'm just looking to setup a basic character movement. This character moves independent of the camera, camera is really just a 3rd person type in the scene.
Right now I was just using a vector which got the characters position and rotation and in the loop I was moving a character along the X axis and then trying to get him to rotate and begin moving on that new X axis direction but trouble is he moves fine and begins to rotate but just continues on the positions old normal facing.
Basically begins moving forward then rotates lets say 45.0 degrees ,but then doesn't move along that new direction but just keeps going the old direction facing.
vector3df pos_character = node->getPosition();
vector3df rotation_character = node->getRotation();
pos_character.X++; // Loop is here
rotation_character.Y++;
node->setPosition(pos_character / 32);
node->setRotation(rotation_character / 32);
I'm sure there is a code snippet somewhere but most I found were for the camera mostly tied to a node or "player" mines more for AI not controlled by the camera.
Also the above is for prototyping ^^ an example I know it's crap LOL
I would think that rotation is applied before translation, as the reverse would not make sense. So you need to position the character using world coordinates. Alternatively, parent the character to an empty scene node. But I would think it best to work directly in world coordinates because I'm sure there will come a time when you will want to know where your character actually is.
I found your post I tried your method I must be using it wrong because with the method I posted above, If I tell the node in the loop to move along the X axis and any rotation applied the node does move in the direction of the new axis after any rotation's. Yours didn't seem to do that but I'm positive I must be using it wrong.
IAnimatedMeshSceneNode* node = createthenode();
to rotate the node
node->setRotation(somerotation);
to move forward
node->setPosition(node->getPosition() * getIn(node) * speed;
to move backward
node->setPosition(node->getPosition() * getIn(node) * -speed;
to strafe left
node->setPosition(node->getPosition() * getLeft(node) * speed;
to strafe right
node->setPosition(node->getPosition() * getLeft(node) * -speed;
to turn left
node->setRotation(node->getRotation() + somerotationvector;
//First get the position and rotation.
vector3df opos = mynode->getAbsolutePosition();
vector3df orot = mynode->getRotation();
//Now apply translation/rotation.
float movement_speed = 1 * time_step; //time_step is the time since the last frame in seconds.
float turning_speed = 2 * time_step; //This prevents movement speed changes at different frame rates.
//Use += and -= for different directions.
orot.Y += turning_speed;
opos.X += movement_speed * sin((orot.Y * 3.14) / 180);
opos.Z += movement_speed * cos((orot.Y * 3.14) / 180);
//Set the new position and rotation.
mynode->setPosition(opos);
mynode->setRotation(orot);