3rd Person Camera
-
- Posts: 386
- Joined: Thu Sep 25, 2003 12:43 pm
- Contact:
3rd Person Camera
I've been trying for a hour or two.. still can't get a camera to follow my player as he moves around like a 3rd person camera. Could someone help me out here?
-
- Posts: 386
- Joined: Thu Sep 25, 2003 12:43 pm
- Contact:
-
- Posts: 8
- Joined: Mon Nov 10, 2003 2:34 pm
Hi,
DarkWhoppy, have you got it it working yet .
I been able to get something working that follows a player arounds, (rotates left and right around player, moves etc ), but am really struggling with the up/down rotation.
Once I have this working I will post the code, so any help to overcome this last problem would be great.
DarkWhoppy, have you got it it working yet .
I been able to get something working that follows a player arounds, (rotates left and right around player, moves etc ), but am really struggling with the up/down rotation.
Once I have this working I will post the code, so any help to overcome this last problem would be great.
-
- Posts: 91
- Joined: Fri Oct 31, 2003 5:03 am
is it possible to do it this way?
Could you not just set a point in front of the player, then update the camera to look at that point each movement?
As the player rotates, rotate the point around the player. As he moves, update the point with the same movement.
This is just an idea, I am new to irrlicht. Can't wait to get home to play with the library
As the player rotates, rotate the point around the player. As he moves, update the point with the same movement.
This is just an idea, I am new to irrlicht. Can't wait to get home to play with the library
daveandrews.org - A Christian Programmer's Weblog | Dusty Engine - A Task Engine for Irrlicht
I haven't tried that out yet, but I think up/down rotation is easy:
(For this code you must ínsert the correct namespaces and the camera must be a child of your player-model)
// In Eventreceiver:
if (event.EventType == EET_MOUSE_INPUT_EVENT) {
vector3d campos = vector3df(0,0,0);
campos->rotateYZBy(event.MouseInput.Y * 180 / ResY, your_model->getPosition());
your_camera->setPosition(campos);
}
I think, that's all. Just if you're wondering:
By doing "event.MouseInput.Y * 180 / ResY" you can rotate by 180 degrees around the player, independent of the resolution.
Perhaps you have to play arround with with the rotate-function. Perhaps you have to add 90 or 180 degrees or something else to get the effect you wish.
Good luck!
(For this code you must ínsert the correct namespaces and the camera must be a child of your player-model)
// In Eventreceiver:
if (event.EventType == EET_MOUSE_INPUT_EVENT) {
vector3d campos = vector3df(0,0,0);
campos->rotateYZBy(event.MouseInput.Y * 180 / ResY, your_model->getPosition());
your_camera->setPosition(campos);
}
I think, that's all. Just if you're wondering:
By doing "event.MouseInput.Y * 180 / ResY" you can rotate by 180 degrees around the player, independent of the resolution.
Perhaps you have to play arround with with the rotate-function. Perhaps you have to add 90 or 180 degrees or something else to get the effect you wish.
Good luck!
there's an example in this site http://www.gametutorials.com/Tutorials/ ... GL_Pg1.htm
it's in OpenGL, i hope it helps
it's in OpenGL, i hope it helps