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!
Hi,
i m making a game with 3rd person camera. now when i ratate the camera on x axis it looks towards sky, it does not set its target (hero). but its rotating on y axis perfectly.
here is the code:
//Place the Camera on the Character Model
camera->setTarget(tris_node->getAbsolutePosition()+vector3df(0,120-lastMousePos.Y,0));
tris_node->setRotation(vector3df(0.f, char_direc, 0.f));
My problem is simple. camera rotation on x axis has some proble. as when i rotate it, the camera looks towards the sky, while it should always look at its target (the hero).
after trying to understand your question and reading your code I also dont quite know what to tell you.
All your code does is finding the mousePos and if greater lastMousePos incrementing a value char_direc, if less decrementing by another value mouse_sensitivity, setting the camera target on top of something (tris_node) with 120-lastMousePos.Y above and rotating the tris_node to you char_direc and making sure that stays between -360 - 360...
Really dont see where you rotate the camera there, and if you set the target 120 units above the character maybe thats why your camera looks to the "sky".
It's unclear what your problem is. The camera can be rotated but you're setting a target. So maybe it's just to high
Yes zillion42, right, seems that u r a good trnaslator, a little more, i think i hv almost near the mistake point .a little more .
//Place the Camera on the Character Model
camera->setTarget(tris_node->getAbsolutePosition()+vector3df(0,0-lastMousePos.Y,0));
tris_node->setRotation(vector3df(0.f, char_direc, 0.f));