Hello guys,
I started with Unity development some weeks ago and still learning a lot, but I'm facing a very strange issue involving a following camera.
I'm using scripts taken from the standard assets Unity provides, but the camara is not smooth when the object is moving fast (rigidbody.velocity > 60).
I uploaded a youtube video to show this odd issue. In the top side of the video you'll see a static camera showing that the object movement is smooth, and in the bottom side you'll see the following camera (it's a 2D following camera). Note that when the object goes fast, it starts to glitch.
EDIT: Sorry I forgot to add the video link: http://www.youtube.com/watch?v=IMH12OHPS9U
This is the JS code used for the camara (SmoothFollow2D):
var target : Transform;
var smoothTime = 0.3;
private var thisTransform : Transform;
private var velocity : Vector2;
function Start()
{
thisTransform = transform;
}
function LateUpdate()
{
thisTransform.position.x = Mathf.SmoothDamp( thisTransform.position.x,
target.position.x, velocity.x, smoothTime);
thisTransform.position.y = Mathf.SmoothDamp( thisTransform.position.y,
target.position.y, velocity.y, smoothTime);
}
The target is set to a gameobject containing all the objects used for hte UFO.
What could be happening?
Thanks in advance for your help, Juan.