public void ClearInput() { if (JoystickControls) { JoystickControls.ClearInputDirection(); } }
/// <summary> /// This function will grab the actual input from the deivces. /// The input grabbed from the devices will be translated to a direction relative to the camera. /// </summary>/ public void MovementControllerUpdate() { if (!Bot_01) { return; } //Set the force vector. forceVector = Vector3.zero; if (Application.isEditor || Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WebGLPlayer) { //forceVector.Scale(movingDirection); forceVector = movingDirection; } else { //Scale by the movement direction of the onscreen controls. forceVector = Controls.GetInputDirection(); } //forceVector = movingDirection + Controls.GetInputDirection(); //Apply the force to the bot. Bot_01.Move(forceVector); //AnimateMovement(forceVector); //Do a clear on the input after we move the bot to get a fresh delta input next frame. if (Controls) { Controls.ClearInputDirection(); } forceVector.Normalize(); //Zero out the movement movingDirection = Vector3.zero; }