Exemplo n.º 1
0
 /// <summary>
 /// Drag two body to different direction to straighten the body
 /// </summary>
 /// <param name="direction">straighten direction</param>
 public static void Straighten(PlayerCoreECS.BodyInfo bodyA, PlayerCoreECS.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);
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// Aligh body's forward direction to desire direction
    /// </summary>
    public static void AlignToVector(PlayerCoreECS.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);
    }