Collider.attachedRigidbody 附加刚体

var attachedRigidbody : Rigidbody

Description描述

The rigidbody the collider is attached to.

碰撞器附加的刚体。

Returns null if the collider is attached to no rigidbody.

如果碰撞器没有附加刚体返回null。

Colliders are automatically connected to the rigidbody attached to the same game object or attached to any parent game object.

碰撞器被自动连接到刚体,刚体附加在相同游戏物体或附加在父游戏物体。

 

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		collider.attachedRigidbody.AddForce(0, 100, 0);
	}
}
// Lift the rigidbody attached to the collider.
//升起附加在碰撞器的刚体
collider.attachedRigidbody.AddForce(0,100,0);
Page last updated: 2010-12-12