예제 #1
0
 /// <summary>
 /// Drag two body to different direction to straighten the body
 /// </summary>
 /// <param name="direction">straighten direction</param>
 public static void Straighten(PlayerCore.BodyInfo bodyA, PlayerCore.BodyInfo bodyB, Vector3 direction, float force, ForceMode forceMode)
 {
     if (bodyA.BodyRigid != null && bodyB.BodyRigid != null)
     {
         bodyA.BodyRigid.AddForce(direction * force, forceMode);
         bodyB.BodyRigid.AddForce(-direction * force, forceMode);
     }
 }
예제 #2
0
    /// <summary>
    /// Aligh body's forward direction to desire direction
    /// </summary>
    public static void AlignToVector(PlayerCore.BodyInfo body, Vector3 alignmentVector, Vector3 targetVector, float stability, float speed, bool showForce = false)
    {
        if (body == null)
        {
            return;
        }

        AlignToVector(body.BodyRigid, alignmentVector, targetVector, stability, speed, showForce);
    }