i have need some code to make mi game help me!!!!

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
moebiusdarvil

i have need some code to make mi game help me!!!!

Post by moebiusdarvil »

how to move a mesh with keyboard ? geave me a code please....
a lot of 3rd persone camer class doesn 't work !!
the mesh move in a bad direction! i think that i use sin and cos and matrix but i don't know the solution ! thanck you for your help!

comment déplacer une maille avec le clavier? mopntrer moi des exemple de code svp
le mouvement de maille dans une mauvaise direction! je pense que j'emploie le péché et le cos et la matrice mais je ne connais pas la solution! thanck vous pour votre aide!
bitmapbrother
Posts: 34
Joined: Wed Aug 10, 2005 6:15 am

Post by bitmapbrother »

Code: Select all

#define PI 3.1415926536			
#define DEG_TO_RAD(angle) ((angle)*PI/180)

// move_vector function
vector3df move_vector(vector3df position,vector3df rotation,float distance)
{
    vector3df moved=position;	
    moved.X=(float)(-sin(DEG_TO_RAD(rotation.Y)))*distance+position.X;
    moved.Z=(float)(-cos(DEG_TO_RAD(rotation.Y)))*distance+position.Z;	
    return moved;
}

example:
float move_by=1.0f; // plus value move forward; minus value move backward
vector3df new_position=move_vector(Node->getPosition(),Node->getRotation(),move_by);
Node->setPosition(new_position);
Post Reply