I have this script attach to a Capsule. How can i attach a Vuforia script,
how can I adapt this script for, On target found, the capsule execute the script.
var speed : float = 1.0; var rotateSpeed : float = 20.0; // rotate speed in degrees per second var gravity : float = 10.0; private var moveDirection : Vector3 = Vector3.zero; private var curDir = 1; function Update () { var controller: CharacterController = GetComponent(CharacterController); if ( controller.isGrounded ) { if (Random.value < 0.05f){ // if random value < 5/100... curDir = -curDir; // flip direction } // Rotate around y - axis transform.Rotate(Vector3.up * curDir * rotateSpeed * Time.deltaTime); moveDirection = speed * transform.TransformDirection(Vector3.forward); } moveDirection.y -= gravity * Time.deltaTime; // apply gravity controller.Move(moveDirection * Time.deltaTime); }
I put Animtation.Stop in OnTrackingLost but stil playing the animation. here is the code.