HingeJoint.motor 动力

var motor : JointMotor

Description描述

The motor will apply a force up to a maximum force to achieve the target velocity in degrees per second.

动力将应用一个最大力来试图达到目标速度,以 度/秒 为单位。

The motor tries to reach motor.targetVelocity angular velocity in degrees per second. The motor will only be able to reach motor.targetVelocity, if motor.force is sufficiently large. If the joint is spinning faster than motor.targetVelocity the motor will break. A negative motor.targetVelocity will make the motor spin in the opposite direction.

动力试图达到motor.targetVelocity角速度,以 度/秒 为单位。 如果motor.force足够大,动力只能达到motor.targetVelocity。如果关节旋转比motor.targetVelocity快,该动力将断开,负motor.targetVelocity值将使得动力以相反的方向旋转。

The motor.force is the maximum torque the motor can exert. If it is zero the motor is disabled. The motor will brake when it is spinning faster than motor.targetVelocity only, if motor.freeSpin is false. If motor.freeSpin is true the motor will not brake.

motor.force是动力能够施加的最大力矩。如果为0,动力将禁用。如果 motor.freeSpin为false,动力将只在旋转比motor.targetVelocity快时断开。如果motor.freeSpin为true,动力不会断开。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	public void Awake() {

		hingeJoint.motor.force = 100;

		hingeJoint.motor.targetVelocity = 90;

		hingeJoint.motor.freeSpin = false;

	}

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

//创建铰链动力每秒旋转90度和一个强大的力



hingeJoint.motor.force = 100;

hingeJoint.motor.targetVelocity = 90;

hingeJoint.motor.freeSpin = false;

Modifying the motor automatically enables the motor by setting HingeJoint.useMotor to true.

通过设置HingeJoint.useMotor为true,修改动力为自动启用动力。

Page last updated: 2011-1-28