JointDrive.mode 模式

var mode : JointDriveMode

Description描述

Whether the drive should attempt to reach position, velocity, both or nothing

驱动是否试图达到位置、速度、两者或无。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void Start() {

		ConfigurableJoint joint = gameObject.AddComponent<ConfigurableJoint>();

		joint.targetPosition = new Vector3(0, 0, -10);

		JointDrive drive = new JointDrive();

		drive.positionSpring = 50;

		drive.mode = JointDriveMode.Position;

		joint.zDrive = drive;

	}

}
// Create a JointDrive, configure it and assign the JointDrive to

// the zDrive element of a configurable joint.

//创建一个关节驱动,配置它并指定关节驱动到一个可配置关节的zDrive元素



function Start() {

	var joint : ConfigurableJoint = gameObject.AddComponent(ConfigurableJoint);

	joint.targetPosition = Vector3(0,0,-10);



	var drive : JointDrive = JointDrive();

	drive.positionSpring = 50;



	drive.mode = JointDriveMode.Position;



	joint.zDrive = drive;

}
Page last updated: 2011-1-27