Package jsim.field
Class GamePiece
java.lang.Object
jsim.field.GamePiece
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 Summary
Modifier and TypeMethodDescriptiongetBody()The underlying physics body.edu.wpi.first.math.geometry.Translation3dedu.wpi.first.math.geometry.Pose3dgetPose()AdvantageScope gamepiece variant name.booleanisHeld()Whether this game piece is currently attached to aGamePieceGripper.
-
Method Details
-
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
The underlying physics body. Use this for direct velocity/force manipulation or to attach force generators viaSimWorld.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 aGamePieceGripper. While held, the piece follows the robot's intake point and does not respond to gravity or collisions independently.- Returns:
trueif held by a gripper
-