- Home /
Create camera transition from one point to top of object
Hi!
I am creating a game similar to Dungeon Defense. Youtube video
I need you at some point, when the player selects to create building, the camera moves smoothly from where it are positioned and located,to behind the building and rise up, to rotate and orient the building to the desired angle with the mouse, then when terminate or cancel the order, the camera returns to the previous point gently.
Answer by sparkzbarca · Dec 10, 2012 at 04:36 PM
slerp is used to move smoothly between 2 points
http://docs.unity3d.com/Documentation/ScriptReference/30_search.html?q=slerp
transform.position = vector3.slerp(from_position,to_position,time.deltatime * speed);
transform.rotation = quanternion.slerp(from_rotation,to_rotatoin,time.deltatime * speed);
vector3 is used to smooth the movement in space.
quanternion is used to smooth the rotation, the turning the camera to look.
you can use
transform.lookat(object or point in space) to look directly at an object.