My first problem is is that I cannot use some of the simple commands like I thought you could(like so):
Code: Select all
ICameraSceneNode* camera=smgr->addCameraSceneNodeFPS();
camera->setRelativePosition(tris_node);
So being fed up with that, I began to think of a way to move the player, regardless of not being able to actually implement it. So my question is, can someone help me translate what I have into Irrlicht code?
So, I'll just dive into it. I figured I'd have the player model face the cursor, or the middle of the screen. Then using cos and sin make him move based on the direction. My basic "code"(this is without middle stuff, and without mostly everything else, just the necessary code):
Code: Select all
float char_speed=4;
float char_direc=0;
if(keys[KEY_KEY_W])
{
tris_node->setPosition(tris_node->getPosition()+vector3df(cos(((char_direc)*pi/180)*char_speed,0,-sin(((char_direc)*pi/180)*char_speed));
}
if(keys[KEY_KEY_A])
{
tris_node->setPosition(tris_node->getPosition()+vector3df(cos(((char_direc+90)*pi/180)*char_speed,0,-sin(((char_direc+90)*pi/180)*char_speed));
}
if(keys[KEY_KEY_S])
{
tris_node->setPosition(tris_node->getPosition()+vector3df(cos(((char_direc+180)*pi/180)*char_speed,0,-sin(((char_direc+180)*pi/180)*char_speed));
}
if(keys[KEY_KEY_D])
{
tris_node->setPosition(tris_node->getPosition()+vector3df(cos(((char_direc+270)*pi/180)*char_speed,0,-sin(((char_direc+270)*pi/180)*char_speed));
}
So to summarize:
*How do I set the camera to a certain point of another node(just the basic code, I'll come up with my own camera functions).
*How do I define the direction of a camera, to face the middle of the screen(I was thinking since the FPS camera already faces the middle of the screen, maybe I could just have the player face the direction the camera is facing, but I don't know which is better to use).
If you can't understand my gibber gabber, feel free to call me a noob and flame me for a while. But not too long.....cause it just gets old....