Version: 2020.2
言語: 日本語

JointMotor

struct in UnityEngine

マニュアルに切り替える

説明

関節部分にモーターを取り付けるために使用されます。

For example the HingeJoint can be told to rotate at a given speed and force. The joint will then attempt to reach the velocity with the given maximum force.
See Also: HingeJoint.

using UnityEngine;

public class Example : MonoBehaviour { void Start() { HingeJoint hinge = GetComponent<HingeJoint>();

// Make the hinge motor rotate with 90 degrees per second and a strong force. JointMotor motor = hinge.motor; motor.force = 100; motor.targetVelocity = 90; motor.freeSpin = false; hinge.motor = motor; } }

変数

forceモーターに力を適用する
freeSpin有効になっている場合、加速が遅くなることがなくなる
targetVelocity設定した速度に強制的に働かせる