- Home /
Question by
AcidMage · Dec 18, 2012 at 02:31 AM ·
javascripterrormultiplyunexpected token
Error message: "Unexpected token *" javascript - wha?
Not quite sure why, it works fine in other scripts - probably a formatting thing? I'm pretty new to javascript so I expect I've done something a bit silly. Here's my script:
var target: Transform;
var distance = 10.00;
var height = 5.00;
var heightDamping = 2.0;
var rotationDamping = 3.0;
function LateUpdate () {
transform.LookAt(target);
var wantedRotationAngle = target.eulerAngles.y;
var wantedHeight = target.position.y + height;
var currentRotationAngle = transform.eulerAngles.y;
var currentHeight = transform.position.y;
currentRotationAngle = Mathf.LerpAngle (currentRotationAngle, wantedRotationAngle, rotationDamping, * Time.deltaTime);
currentHeight = Mathf.Lerp (currentHeight, wantedHeight, heightDamping, * Time.deltaTime);
var currentRotation = Quaternion.Euler (0, currentRotationAngle, 0);
transform.position = target.position;
transform.position -= currentRotation * Vector3.forward * distance;
transform.position.y = currentHeight;
}
Comment
Answer by Eric5h5 · Dec 18, 2012 at 02:33 AM
You have commas after rotationDamping and heightDamping.
Derp, silly me - new it was gonna be something like that! Haha, thanks heaps.