- Home /
Question by
Chris12345 · Mar 22, 2013 at 03:17 PM ·
errorfollow
Simple Script Error?
why do i get this error?
transform.position assign attempt for 'key' is not valid. Input position is { NaN, -0.337238, 3.047216 }.
UnityEngine.Transform:set_position(Vector3)
follow:Update() (at Assets/Scripts/follow.js:16)
and here is the code:
#pragma strict
var target : Transform;
var smoothTime = 0.3;
private var Transform : Transform;
private var velocity : Vector3;
var offsetAmountx : float = 10.00;
var offsetAmounty : float = 10.00;
var offsetAmountz : float = 10.00;
function Start () {
Transform = transform;
}
function Update () {
Transform.position.y = Mathf.SmoothDamp( Transform.position.y,
target.position.y +offsetAmounty,velocity.y, smoothTime);
Transform.position.x = Mathf.SmoothDamp( Transform.position.x,
target.position.x +offsetAmountx,velocity.x, smoothTime);
Transform.position.z = Mathf.SmoothDamp( Transform.position.z,
target.position.z +offsetAmountz,velocity.z, smoothTime);
}
Comment