- Home /
Completing my run scipt.
Here is my java : function Update () { if (Mathf.Abs(Input.GetAxis("Left Shift")) > 0.1); (other.CharecterMotor); other.CharacterMotor.MaxForwardSpeed = 35; }
Unity keeps telling me that it other is an unknown identifier. I don't know what do do about it now.
Post you full script, I don't see from where the "other" came.
that is my full script, I got the "other" part from my friend. All I want to do is make the player speed up.
On unity's scripting reference to use a rigid body's effects they put
// Disables gravity on all rigid bodies entering this collider. function OnTriggerEnter (other : Collider) { if (other.attachedRigidbody) { other.attachedRigidbody.useGravity = false; } } // Turn this collider into a trigger on startup collider.isTrigger = true;
In this function, "other" is a parameter. In your update function, other came out of nowhere.
Character$$anonymous$$otor is misspelled (first time) -- a seperate bug that unity will gripe about.
Answer by jogo13 · Feb 03, 2013 at 06:44 PM
Youe 'player' gameobject needs both the Character Controller and CharacterMotor scripts applied. You'll then then to grab the Character Motor script ('component') by the following:
void Start(){
CharacterMotor cm = GetComponent("CharacterMotor");
}
Now change other.CharacterMotor to 'cm' in the update function like so:
cm.MaxForwardSpeed = 35;