Class InverseKinematics

java.lang.Object
mindustry.graphics.InverseKinematics

public class InverseKinematics extends Object
  • Constructor Details

    • InverseKinematics

      public InverseKinematics()
  • Method Details

    • solve

      public static boolean solve(float lengthA, float lengthB, Vec2 end, boolean side, Vec2 result)
    • solve

      public static boolean solve(float lengthA, float lengthB, Vec2 end, Vec2 attractor, Vec2 result)
      inputs:
      Parameters:
      lengthA - first line segment length
      lengthB - second line segment length
      end - length of the endpoint you want to reach
      attractor - direction you want the result to be closer to (since there are usually 2 solutions) output:
      result - a point in-between (0, 0) and (end) such that (0, 0).dst(result) == lengthA and result.dst(end) == lengthB - or in basic terms, the position of a joint between (0, 0) and end where the two lengths of segments are lengthA and lengthB
      Returns:
      whether IK succeeded (this can fail if end is too far, for example)