モーター( Motor )により角度/秒が設定された速度となるように力を加えます。
モーターは JointMotor.targetVelocity で設定された角度/秒単位の角速度に到達しようとします。
モーターは JointMotor.force が十分な大きさである場合にかぎり targetVelocity に到達できます。
もしジョイントが targetVelocity より速く回転するとモーターは壊れます。
負の値の targetVelocity によりモーターは反対方向に回転します。
モーターが出力できる最大のトルクが force です。0 の場合、モーターは無効化されます。
モーターは JointMotor.freeSpin が false の場合にかぎり targetVelocity より速く回転すると壊れます。
もし freeSpin が true の場合、モーターは壊れません。
See Also: useMotor, JointMotor.
function Start() {
var hinge = GetComponent.<HingeJoint>();
// Make the hinge motor rotate with 90 degrees per second and a strong force.
var motor = hinge.motor;
motor.force = 100;
motor.targetVelocity = 90;
motor.freeSpin = false;
hinge.motor = motor;
hinge.useMotor = true;
}
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void Start() { HingeJoint hinge = GetComponent<HingeJoint>(); JointMotor motor = hinge.motor; motor.force = 100; motor.targetVelocity = 90; motor.freeSpin = false; hinge.motor = motor; hinge.useMotor = true; } }
モーターを変更しても、モーターは自動的に有効化されません。
spring が有効になっている場合、motor を有効にすると spring を オーバーライド します。motor を再び無効にした場合、spring が有効になります。