Hi
Im having trouble with the Js ive written below.
Im creating a GUI button that when clicked moves the player to a defined position using the SmoothDamp function.
But cant seem to get the code working and help or tips would be excellent.
var target : Transform;
var smoothTime = 0.3;
private var velocity = Vector3.zero;
function OnGUI () {
if (GUI.Button (Rect (150,10,140,70), “Fly me to earth”)) {
OnMouseDown () {
var targetPosition : Vector3 = target.TransformPoint(Vector3(0, 5, -30));
transform.position = Vector3.SmoothDamp(transform.position, targetPosition, velocity, smoothTime);
}
}
}
Thanks in advance J