using UnityEngine; public class DoggoMovement : MonoBehaviour { public float drag = 0.1f; private CollisionChecker[] checkers; private Rigidbody rig; private Rigidbody[] rigs; private MovementHandler move; private void Start() { move = base.transform.root.GetComponent(); rigs = base.transform.root.GetComponentsInChildren(); checkers = base.transform.root.GetComponentsInChildren(); rig = GetComponent(); } private void FixedUpdate() { float num = 1f; num = 0f; for (int i = 0; i < checkers.Length; i++) { if (checkers[i].sinceGrounded < 0.3f) { num += 1f / (float)checkers.Length; } } move.multiplier = num; Rigidbody[] array = rigs; foreach (Rigidbody rigidbody in array) { rigidbody.velocity *= 1f - drag * num; rigidbody.angularVelocity *= 1f - drag * num; } rig.AddTorque(Vector3.Angle(base.transform.up, Vector3.up) * Vector3.Cross(base.transform.up, Vector3.up) * 50f * num, ForceMode.Acceleration); } }