I'd like to implement a 3rd person camera but I'm stuck.
Briefly, my system is composed as follow: an empty object, parented to the player and used as target; a camera parented to the target, so that it can rotates accordingly.
Moving the mouse along x axis has the effect of rotates the target left and right, and the camera with it around the player; on the other hand, moving the mouse along Y axis, turns the target up and down.
But how I have to build the matrix rotations in the right way?
Is there in Irrlicht a function to perform this task, like ad example "BuildTheMatrix()" I found in other API'S?
Otherwise, could you please point me in the right direction to build a specific one for this purpose?
Thanks for your help, bye!
This is the code I used for but it didn't work as expected...
Code: Select all
void TP_Camera::Update(float dt)
{
CamYaw += -inputHandler->GetMouseDeltaY() * Sensitivity;
CamPitch += inputHandler->GetMouseDeltaX() * Sensitivity;
if (CamYaw > 0.60)
CamYaw = 0.60f;
if (CamYaw < -0.90)
CamYaw = -0.90;
vector3df camRot(CamYaw, CamPitch, 0);
camRot *= RADTODEG;
camRot.rotationToDirection(camRot);
target->setRotation(camRot);
CamYaw = 0;
CamPitch = 0;
}