public void Execute(ref RigidbodyTorque rigidbodyTorque, [ReadOnly] ref RigidbodyVelocity rigidbodyVelocity, [ReadOnly] ref ControlTorqueAngular controlTorqueAngular) { if (controlTorqueAngular.torque == 0f) { return; } if (controlTorqueAngular.angular.Equals(float3.zero) && controlTorqueAngular.zeroEnable == false) { return; } rigidbodyTorque.torque += RigidbodyEx.AddForce(controlTorqueAngular.torque, controlTorqueAngular.maxTorque, controlTorqueAngular.angular, rigidbodyVelocity.angular); }
public void Execute(ref RigidbodyForce rigidbodyForce, [ReadOnly] ref RigidbodyVelocity rigidbodyVelocity, [ReadOnly] ref ControlForceDirection controlForceDirection) { if (controlForceDirection.force == 0f) { return; } if (controlForceDirection.direction.Equals(float3.zero) && controlForceDirection.zeroEnable == false) { return; } var linear = rigidbodyVelocity.linear; RigidbodyEx.ClampLinearVelocity(controlForceDirection.maxVelocity, ref linear); rigidbodyForce.force += RigidbodyEx.AddForce(controlForceDirection.force, controlForceDirection.maxVelocity, controlForceDirection.direction, linear); }