Animating Camera
Hi,
I have an camera that follows my character such as third person cams. When the character turns left or right, the camera turns same as the character. But this turning or rotating is sharply. I want to rotate the camera smoothly. When the character's direction changed, I set the charecter's direction to the camera's direction. So, rotating of the camera is sharply. How can I do a smooth camera animation in this perform?
lets see, something like this
vector endPos // postion that you want it to move to
float endRot // rotation you want it to end at
float movespeed // speed to translate
float deltaTime // time since last update/frame
vector currPos // postion of camera
float currRot // rotation of camera
vector diffPos = endPos - currPos // difference of positions
float diffRot = endRot - currRot // difference of rotations
// the tween
currPos = currPos + diffPos * moveSpeed * deltaTime;
currRot = currRot + diffRot * moveSpeed * deltaTime;
that should work or be a start..
try a google Tweening... Linear...Easing..Quadratic..
vector endPos // postion that you want it to move to
float endRot // rotation you want it to end at
float movespeed // speed to translate
float deltaTime // time since last update/frame
vector currPos // postion of camera
float currRot // rotation of camera
vector diffPos = endPos - currPos // difference of positions
float diffRot = endRot - currRot // difference of rotations
// the tween
currPos = currPos + diffPos * moveSpeed * deltaTime;
currRot = currRot + diffRot * moveSpeed * deltaTime;
that should work or be a start..
try a google Tweening... Linear...Easing..Quadratic..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement