Version: 5.5
public void AddForceAtPosition (Vector3 force, Vector3 position, ForceMode mode= ForceMode.Force);

パラメーター

force ワールド座標における力のベクトル
position ワールド座標における位置

説明

特定の位置から力を適用します。結果、これはトルクを適用しオブジェクトに力を加えます

For realistic effects position should be approximately in the range of the surface of the rigidbody. This is most commonly used for explosions. When applying explosions it is best to apply forces over several frames instead of just one. Note that when position is far away from the center of the rigidbody the applied torque will be unrealistically large.

力は、アクティブのリジッドボディにのみ適用することができます。ゲームオブジェクトが非アクティブの場合、AddForceAtPosition は効果がありません。

リジッドボディはデフォルトでスリープ状態から起き上がります。力のサイズが 0 の場合、リジッドボディはスリープのままです。

See Also: AddForce, AddRelativeForce, AddTorque.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void ApplyForce(Rigidbody body) { Vector3 direction = body.transform.position - transform.position; body.AddForceAtPosition(direction.normalized, transform.position); } }