private void GetComponents() { playUi = GetComponent <PlayUI>(); modeController = GetComponent <ModeController>(); leftForce = leftPusher.GetComponentInChildren <ApplyForce>(); rightForce = rightPusher.GetComponentInChildren <ApplyForce>(); leftPushHelper = playUi.leftPushButton.GetComponent <ButtonHelper>(); rightPushHelper = playUi.rightPushButton.GetComponent <ButtonHelper>(); }
public void FixedUpdate() { if (Driver) { var look = Driver.Look; var rigidbody = Rigidbody; if (Math.Abs(look.x) > 0.001f) { ApplyForce.Gyroscope(rigidbody, transform.localPosition, Axis.Y, RADIUS, look.x * ROT_POWER, ForceMode.Force); } if (Math.Abs(look.y) > 0.001f) { ApplyForce.Gyroscope(rigidbody, transform.localPosition, Axis.X, RADIUS, look.y * ROT_POWER, ForceMode.Force); } if (Math.Abs(look.z) > 0.001f) { ApplyForce.Gyroscope(rigidbody, transform.localPosition, Axis.Z, RADIUS, look.z * ROT_POWER, ForceMode.Force); } } }
protected void DoApplyForce(Vector3 force, ForceMode forceMode) { rigidBody.AddForce(force, forceMode); ApplyForce?.Invoke(force); }