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

スクリプト言語

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

HingeJoint.motor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public var motor: JointMotor;
public JointMotor motor;
public motor as 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;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    void Example() {
        hingeJoint.motor.force = 100;
        hingeJoint.motor.targetVelocity = 90;
        hingeJoint.motor.freeSpin = false;
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	def Example() as void:
		hingeJoint.motor.force = 100
		hingeJoint.motor.targetVelocity = 90
		hingeJoint.motor.freeSpin = false

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