Good afternoon. Still a Unity n00b here and, I’m trying to do as the subject says using Vector3. Here’s a sampling of the script (borrowed from the Lerpz tutorial:
var topSpeed = 20.0;
var minSpeed = 1.5;
var currentSpeed;
function FixedUpdate ()
{
currentSpeed = Vector3(Mathf.Lerp(minSpeed, topSpeed, Time.fixedDeltaTime), 0, 0);
}
function Update ()
{
var playerController : ThirdPersonController = GetComponent(ThirdPersonController);
//var currentSpeed = playerController.GetSpeed();
//Fade in gallop
if (currentSpeed > 12.0)
{
animation.CrossFade("gallop");
animation.Blend("jump", 0);
}
// Fade in run
else if (currentSpeed > 6.0) //playerController.walkSpeed)
{
animation.CrossFade("trot");
// We fade out jumpland quick otherwise we get sliding feet
animation.Blend("jump", 0);
}
// Fade in walk
else if (currentSpeed > 0.1)
{
animation.CrossFade("walk");
// We fade out jumpland realy quick otherwise we get sliding feet
animation.Blend("jump", 0);
}
// Fade out walk and run
else
{
animation.Blend("walk", 0.0, 0.3);
animation.Blend("trot", 0.0, 0.3);
animation.Blend("gallop", 0.0, 0.3);
}
animation["trot"].normalizedSpeed = trotSpeedScale;
animation["walk"].normalizedSpeed = walkSpeedScale;
animation["gallop"].normalizedSpeed = gallopSpeedScale;
}
But at this line of code
if (currentSpeed > 12.0)
I get a LONG error message that reads:
MissingMethodException: Method not found: ‘UnityEngine.Vector3.op_GreaterThan’.
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher ()
Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create ()
Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object args)
Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object args)
Boo.Lang.Runtime.RuntimeServices+c__AnonStorey12.<>m__6 ()
Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.String cacheKeyName, System.Type cacheKeyTypes, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.GetDispatcher (System.Object target, System.Object args, System.String cacheKeyName, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory)
Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object args)
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
Rethrow as MissingMethodException: Greater than is not applicable to operands ‘UnityEngine.Vector3’ and ‘System.Single’.
Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator (System.String operatorName, System.Object lhs, System.Object rhs)
ThirdPersonPlayerAnimationHorse.Update () (at Assets/Maya_Models/Scripts/ThirdPersonPlayerAnimationHorse.js:59)
So what is it that I’m doing wrong THIS time?