Package jsim.field

Class GamePiece

java.lang.Object
jsim.field.GamePiece

public final class GamePiece extends Object
A dynamic game piece backed by a SimBody, with a named variant that maps to an AdvantageScope gamepiece model (e.g. "Note", "Coral").

Obtain instances from FieldSimulator.spawnGamePiece(java.lang.String, jsim.api.SimBodyBuilder). All physics state (pose, velocity, mass, collider) is managed through the underlying SimBody.

  • Method Details

    • getVariant

      public String getVariant()
      AdvantageScope gamepiece variant name. Must match the key used in the AdvantageScope asset configuration (e.g. "Note" for 2024 Crescendo, "Coral" for 2025 Reefscape).
      Returns:
      the variant name
    • getBody

      public SimBody getBody()
      The underlying physics body. Use this for direct velocity/force manipulation or to attach force generators via SimWorld.addForceGenerator(jsim.forces.ForceGenerator).
      Returns:
      the backing SimBody
    • getPose

      public edu.wpi.first.math.geometry.Pose3d getPose()
      Returns:
      current world-frame pose
    • getLinearVelocity

      public edu.wpi.first.math.geometry.Translation3d getLinearVelocity()
      Returns:
      current linear velocity in world frame (m/s)
    • isHeld

      public boolean isHeld()
      Whether this game piece is currently attached to a GamePieceGripper. While held, the piece follows the robot's intake point and does not respond to gravity or collisions independently.
      Returns:
      true if held by a gripper