「オブジェクトに力を加える」の編集履歴(バックアップ)一覧はこちら
「オブジェクトに力を加える」(2015/04/01 (水) 23:35:31) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
GameObjectのcubeに、(x,y,z)の力を加える
cube.transform.GetComponent<Rigidbody>().AddForce(new Vector3(nx, ny, nz));
ジャンプ威力
public float jumpPower = 3.0f;
private Rigidbody rb;
重力の影響あり
rb.useGravity = true;
rb.AddForce(Vector3.up * jumpPower, ForceMode.VelocityChange);
ForceMode一覧
Force 質量を考慮して継続的に力を加える
Acceleration 質量を無視して力を加える
Impulse 質量を考慮して瞬時に力を加える(力積を加える)
VelocityChange 質量を無視して瞬時に力を加える(速度を変える)
オブジェクトが向いている方向に力を加える
this.GetComponent<Rigidbody>().AddForce(transform.forward*1000);
transform.forwardがthisが向いている方向
GameObjectのcubeに、(x,y,z)の力を加える
cube.transform.GetComponent<Rigidbody>().AddForce(new Vector3(nx, ny, nz));
ジャンプ威力
public float jumpPower = 3.0f;
private Rigidbody rb;
重力の影響あり
rb.useGravity = true;
rb.AddForce(Vector3.up * jumpPower, ForceMode.VelocityChange);
ForceMode一覧
Force 質量を考慮して継続的に力を加える
Acceleration 質量を無視して力を加える
Impulse 質量を考慮して瞬時に力を加える(力積を加える)
VelocityChange 質量を無視して瞬時に力を加える(速度を変える)
オブジェクトが向いている方向に力を加える
this.GetComponent<Rigidbody>().AddForce(transform.forward*1000);
transform.forwardがthisが向いている方向