言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

HingeJoint.motor

Switch to Manual
public var motor: JointMotor;

Description

モーター(Motor)により角度/秒が設定された速度となるように力を加えます。

モーターは /motor.targetVelocity/ で設定された角度/秒単位の角速度を到達しようとします。 モーターは /motor.force/ が十分な大きさである場合にかぎり /motor.targetVelocity/ に到達できます。 もしジョイントが /motor.targetVelocity/ モーターより速く回転するとモーターは壊れます。 負の値の /motor.targetVelocity/ によりモーターは反対方向に回転します。 モーターが出力できる最大のトルクが /motor.force/ です。ゼロの場合、モータは無効化されます。 モータは /motor.freeSpin/ が false の場合にかぎり /motor.targetVelocity/ より速く回転すると壊れます。 もし /motor.freeSpin/ が true の場合、モーターは壊れません。

	// Make the hinge motor rotate with 90 degrees per second and a strong force.

	hingeJoint.motor.force = 100;
	hingeJoint.motor.targetVelocity = 90;
	hingeJoint.motor.freeSpin = false;

モーターで HingeJoint.useMotor を true に修正することで自動的にモーターを有効化します。