Dzxyan
October 23, 2013, 3:11am
1
How to make camera up smooth?
My camera will go up instantly,
I wanna make it up smooth.
Any Help?
This is my code
void CameraUp()
{
Vector3 myCamera = transform.position;
myCamera.y += 0.98f;
transform.position = myCamera;
GameObject go = (GameObject)Instantiate(myPrefab, (myCamera - new Vector3(-1.5f, 0, -1f)), Quaternion.identity);
}
Look at Mathf.Lerp or Mathf.MoveTowards, alternately look at some of the free Tween libraries available on the asset store.
Check out the Vector3 static functions in the Scripting Reference section of the documentation.
Dzxyan
October 23, 2013, 5:48am
4
I try Mathf.Lerp and Mathf.MoveTowards but it still instant,
how to tween it?
SteveJ
October 23, 2013, 6:32am
5
There’s also a couple of camera smoothing scripts in the “Scripts” asset package that comes with Unity. Might be of some assistance to you, even as a source of ideas…