Version: 2021.2
언어: 한국어
public void AddForceAtPosition (Vector3 force, Vector3 position, ForceMode mode= ForceMode.Force);

파라미터

force The force vector in world coordinates.
position A position in world coordinates.
mode The type of force to apply.

설명

Applies a force at a specific position, resulting in applying a torque and force on the object.

For realistic effects, position should be approximately in the range of the surface of the Articulation Body. This is ideal for simulating explosions. To create realistic explosions, apply forces over several frames instead of just one. Note that when position is far away from the center of the Articulation Body, the applied torque will be unrealistically large.

You can only apply a force to an active ArticulationBody. If a GameObject is inactive, AddForceAtPosition has no effect.

Applying a force to an ArticulationBody wakes up that body. If the force size is zero then the ArticulationBody does not wake up.
Unit of measurement - N (newtons).

This method does not support ForceMode.Acceleration and ForceMode.VelocityChange.

See Also: AddForce, AddRelativeForce, AddTorque.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void ApplyForce(ArticulationBody body) { Vector3 direction = body.transform.position - transform.position; body.AddForceAtPosition(direction.normalized, transform.position); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961