Hello Wise Ones!
I would like to get object B to follow object A at a set distance. I've attempted to modify the smoothfollow2d.js script like this:
var target : Transform;
var smoothTime = 0.3;
var xOffset : float = 1.0;
var yOffset : float = 1.0;
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) + xOffset;
thisTransform.position.y = Mathf.SmoothDamp( thisTransform.position.y, target.position.y, velocity.y, smoothTime) + yOffset;
}
And it kind of works, but the object follow sort of 'jiggles' and if you look at the inspector, the following objects x, y values are constantly changing (by a very small amount), even though the target object is completely stationary.
I knew it wouldn't be a simple hack! If any of you clever boffins can help me, I'd be much obliged.
Judy x