Rigidbody.SetDensity 设置密度

function SetDensity (density : float) : void

Description描述

Sets the mass based on the attached colliders assuming a constant density.

基于附加的碰撞器假设一个固定的密度设置质量。

This is useful to set the mass to a value which scales with the size of the colliders.

这个可以用来设置质量,随着碰撞器的尺寸而缩放。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public void Awake() {
		rigidbody.SetDensity(1.5F);
	}
}
rigidbody.SetDensity(1.5);
Page last updated: 2011-2-9