public void AddForceAtPosition (Vector2 force, Vector2 position, ForceMode2D mode= ForceMode2D.Force);

파라미터

forceComponents of the force in the X and Y axes.
positionPosition in world space to apply the force.
modeThe method used to apply the specified force.

설명

Apply a force at a given position in space.

The AddForce function applies a force that acts straight through the rigidbody's centre of mass and so produces only positional movement and no rotation. AddForceAtPosition can apply the force at any position in world space and will typically also apply a torque to the object which will set it rotating. Note that for the purposes of this function, the rigidbody is just a coordinate space of infinite size, so there is no reason why the force needs to be applied within the confines of the object's graphic or colliders.

See Also:: AddForce, AddTorque, AddForceAtPosition, ForceMode2D.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961