void FixedUpdate() { if (!photonView.isMine) { return; } localVel = transform.InverseTransformDirection(Body.velocity); reverse = false; if (localVel.z < -1f) { reverse = true; } if (kartUI != null) { kartUI.SetSpeed((int)localVel.z); } turnAndThrust(); turnWheels(); }
/// <summary> /// set direction status vars /// </summary> void setDirection() { //isMoving = body.velocity.magnitude > DeadZone; isMovingForward = Vector3.Dot(transform.forward, body.velocity) >= 0; if (jumpInput == 0) { isSliding = false; } if (!isSliding) { slidingRight = jumpInput > 0 && hInput > SlideZone; slidingLeft = jumpInput > 0 && hInput < -SlideZone; isSliding = slidingRight || slidingLeft; } // if (isSliding) // { // Debug.Log("Sliding!"); // } UI.SetSpeed((int)body.velocity.magnitude); }