Class InverseKinematics

java.lang.Object
mindustry.graphics.InverseKinematics

public class InverseKinematics extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    solve(float lengthA, float lengthB, arc.math.geom.Vec2 end, boolean side, arc.math.geom.Vec2 result)
     
    static boolean
    solve(float lengthA, float lengthB, arc.math.geom.Vec2 end, arc.math.geom.Vec2 attractor, arc.math.geom.Vec2 result)
    inputs:

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InverseKinematics

      public InverseKinematics()
  • Method Details

    • solve

      public static boolean solve(float lengthA, float lengthB, arc.math.geom.Vec2 end, boolean side, arc.math.geom.Vec2 result)
    • solve

      public static boolean solve(float lengthA, float lengthB, arc.math.geom.Vec2 end, arc.math.geom.Vec2 attractor, arc.math.geom.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)