Antonis Z
01-02-2012, 06:33 PM
Hi guys,
I am drawing simple objects on the screen(teapot, circle). What I want to do is: when I select an object I want the camera to target the selected object smoothly.
At the moment I am able to target the selected object but without the animation. I would like some information of how to achieve the animation.
To manage my camera I use this struct:
struct raaCamera
{
float m_fVP[4];
float m_fVT[4];
float m_fVR[4];
float m_fVU[4];
float m_fVD[4];
};
Also I use my own maths for vector operations such as (add, subtract, multiply, projection ...)
To manage the targeting at the moment I use this:
vecSet(x, y, z, g_Camera.m_fVT);
vecSub(g_Camera.m_fVT,g_Camera.m_fVP,g_Camera.m_fV D);
vecNormalise(g_Camera.m_fVD,g_Camera.m_fVD);
I implement camera rotation on mouse movement. The "step" is based on the mouse movement. I believe I can use a similar logic for this problem, but I can't calculate the "step" that I need to target the selected object.
Thanks in advance...
Happy new year,
Antonis
I am drawing simple objects on the screen(teapot, circle). What I want to do is: when I select an object I want the camera to target the selected object smoothly.
At the moment I am able to target the selected object but without the animation. I would like some information of how to achieve the animation.
To manage my camera I use this struct:
struct raaCamera
{
float m_fVP[4];
float m_fVT[4];
float m_fVR[4];
float m_fVU[4];
float m_fVD[4];
};
Also I use my own maths for vector operations such as (add, subtract, multiply, projection ...)
To manage the targeting at the moment I use this:
vecSet(x, y, z, g_Camera.m_fVT);
vecSub(g_Camera.m_fVT,g_Camera.m_fVP,g_Camera.m_fV D);
vecNormalise(g_Camera.m_fVD,g_Camera.m_fVD);
I implement camera rotation on mouse movement. The "step" is based on the mouse movement. I believe I can use a similar logic for this problem, but I can't calculate the "step" that I need to target the selected object.
Thanks in advance...
Happy new year,
Antonis