Class GamePieceOnFieldSimulation
java.lang.Object
org.dyn4j.collision.AbstractCollisionBody<org.dyn4j.dynamics.BodyFixture>
org.dyn4j.dynamics.AbstractPhysicsBody
org.dyn4j.dynamics.Body
org.ironmaple.simulation.gamepieces.GamePieceOnFieldSimulation
- All Implemented Interfaces:
org.dyn4j.collision.CollisionBody<org.dyn4j.dynamics.BodyFixture>
,org.dyn4j.DataContainer
,org.dyn4j.dynamics.PhysicsBody
,org.dyn4j.geometry.Rotatable
,org.dyn4j.geometry.Shiftable
,org.dyn4j.geometry.Transformable
,org.dyn4j.geometry.Translatable
,org.dyn4j.Ownable
- Direct Known Subclasses:
CrescendoNoteOnField
,ReefscapeAlgaeOnField
,ReefscapeCoralAlgaeStack
,ReefscapeCoralOnField
public class GamePieceOnFieldSimulation
extends org.dyn4j.dynamics.Body
Simulates a Game Piece on the Field.
This class simulates a game piece on the field, which has a collision space and interacts with other objects.
Game pieces can be "grabbed" by an IntakeSimulation
.
For the simulation to actually run, every instance must be added to a
SimulatedArena
through
SimulatedArena.addGamePiece(GamePieceOnFieldSimulation)
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final record
Stores the info of a type of game piece -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final double
static final double
final String
The Type of the Game Piece.Fields inherited from class org.dyn4j.dynamics.AbstractPhysicsBody
angularDamping, angularVelocity, atRest, atRestDetectionEnabled, atRestTime, bullet, force, forces, gravityScale, linearDamping, linearVelocity, mass, torque, torques
Fields inherited from class org.dyn4j.collision.AbstractCollisionBody
enabled, fixtureModificationHandler, fixtures, fixturesUnmodifiable, owner, radius, transform, transform0, userData
Fields inherited from interface org.dyn4j.collision.CollisionBody
TYPICAL_FIXTURE_COUNT
Fields inherited from interface org.dyn4j.dynamics.PhysicsBody
DEFAULT_ANGULAR_DAMPING, DEFAULT_LINEAR_DAMPING
-
Constructor Summary
ConstructorsConstructorDescriptionGamePieceOnFieldSimulation
(GamePieceOnFieldSimulation.GamePieceInfo info, Pose2d initialPose) Creates a Game Piece on the Field with Fixed Height.GamePieceOnFieldSimulation
(GamePieceOnFieldSimulation.GamePieceInfo info, DoubleSupplier zPositionSupplier, Pose2d initialPose, Translation2d initialVelocityMPS) Creates a Game Piece on the Field with Custom Height Supplier and Initial Velocity. -
Method Summary
Modifier and TypeMethodDescriptionObtains a 3d pose of the game piece.Obtains the 2d position of the game piecevoid
void
setVelocity
(ChassisSpeeds chassisSpeedsWorldFrame) Sets the world velocity of this game piece.Methods inherited from class org.dyn4j.dynamics.AbstractPhysicsBody
accumulate, addFixture, addFixture, addFixture, applyForce, applyForce, applyForce, applyImpulse, applyImpulse, applyImpulse, applyTorque, applyTorque, clearAccumulatedForce, clearAccumulatedTorque, clearForce, clearTorque, computeSweptAABB, computeSweptAABB, createSweptAABB, createSweptAABB, getAccumulatedForce, getAccumulatedTorque, getAngularDamping, getAngularVelocity, getChangeInOrientation, getChangeInPosition, getForce, getGravityScale, getLinearDamping, getLinearVelocity, getLinearVelocity, getLocalCenter, getMass, getTorque, getWorldCenter, integratePosition, integrateVelocity, isAtRest, isAtRestDetectionEnabled, isBullet, isDynamic, isKinematic, isStatic, removeAllFixtures, removeFixture, removeFixture, removeFixture, removeFixtures, setAngularDamping, setAngularVelocity, setAtRest, setAtRestDetectionEnabled, setBullet, setEnabled, setGravityScale, setLinearDamping, setLinearVelocity, setLinearVelocity, setMass, setMass, setMassType, toString, updateAtRestTime, updateMass
Methods inherited from class org.dyn4j.collision.AbstractCollisionBody
addFixture, computeAABB, computeAABB, contains, containsFixture, createAABB, createAABB, getFixture, getFixture, getFixtureCount, getFixtureIterator, getFixtureModificationHandler, getFixtures, getFixtures, getLocalPoint, getLocalVector, getOwner, getPreviousTransform, getRotationDiscRadius, getTransform, getUserData, getWorldPoint, getWorldVector, isEnabled, rotate, rotate, rotate, rotate, rotate, rotate, rotateAboutCenter, setFixtureModificationHandler, setOwner, setRotationDiscRadius, setTransform, setUserData, shift, translate, translate, translateToOrigin
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.dyn4j.collision.CollisionBody
addFixture, addFixture, computeAABB, computeAABB, contains, containsFixture, createAABB, createAABB, getFixture, getFixture, getFixtureCount, getFixtureIterator, getFixtureModificationHandler, getFixtures, getFixtures, getLocalCenter, getLocalPoint, getLocalVector, getPreviousTransform, getRotationDiscRadius, getTransform, getWorldCenter, getWorldPoint, getWorldVector, isEnabled, removeAllFixtures, removeFixture, removeFixture, removeFixture, removeFixtures, rotateAboutCenter, setEnabled, setFixtureModificationHandler, setTransform, translateToOrigin
Methods inherited from interface org.dyn4j.DataContainer
getUserData, setUserData
Methods inherited from interface org.dyn4j.Ownable
getOwner, setOwner
Methods inherited from interface org.dyn4j.dynamics.PhysicsBody
addFixture, addFixture, applyForce, applyForce, applyForce, applyImpulse, applyImpulse, applyImpulse, applyTorque, applyTorque, clearAccumulatedForce, clearAccumulatedTorque, clearForce, clearTorque, computeSweptAABB, computeSweptAABB, createSweptAABB, createSweptAABB, getAccumulatedForce, getAccumulatedTorque, getAngularDamping, getAngularVelocity, getChangeInOrientation, getChangeInPosition, getForce, getGravityScale, getLinearDamping, getLinearVelocity, getLinearVelocity, getMass, getTorque, integratePosition, integrateVelocity, isAtRest, isAtRestDetectionEnabled, isBullet, isDynamic, isKinematic, isStatic, setAngularDamping, setAngularVelocity, setAtRest, setAtRestDetectionEnabled, setBullet, setGravityScale, setLinearDamping, setLinearVelocity, setLinearVelocity, setMass, setMass, setMassType, updateAtRestTime, updateMass
Methods inherited from interface org.dyn4j.geometry.Rotatable
rotate, rotate, rotate, rotate, rotate, rotate
Methods inherited from interface org.dyn4j.geometry.Shiftable
shift
Methods inherited from interface org.dyn4j.geometry.Translatable
translate, translate
-
Field Details
-
COEFFICIENT_OF_FRICTION
public static final double COEFFICIENT_OF_FRICTION- See Also:
-
MINIMUM_BOUNCING_VELOCITY
public static final double MINIMUM_BOUNCING_VELOCITY- See Also:
-
type
The Type of the Game Piece.
Affects the result of
SimulatedArena.getGamePiecesByType(String)
.
-
-
Constructor Details
-
GamePieceOnFieldSimulation
public GamePieceOnFieldSimulation(GamePieceOnFieldSimulation.GamePieceInfo info, Pose2d initialPose) Creates a Game Piece on the Field with Fixed Height.
- Parameters:
info
- info about the game piece typeinitialPose
- the initial position of the game piece on the field
-
GamePieceOnFieldSimulation
public GamePieceOnFieldSimulation(GamePieceOnFieldSimulation.GamePieceInfo info, DoubleSupplier zPositionSupplier, Pose2d initialPose, Translation2d initialVelocityMPS) Creates a Game Piece on the Field with Custom Height Supplier and Initial Velocity.
- Parameters:
info
- info about the game piece typezPositionSupplier
- a supplier that provides the current Z-height of the game pieceinitialPose
- the initial position of the game piece on the fieldinitialVelocityMPS
- the initial velocity of the game piece, in meters per second
-
-
Method Details
-
setVelocity
Sets the world velocity of this game piece.
- Parameters:
chassisSpeedsWorldFrame
- the speeds of the game piece
-
getPoseOnField
Obtains the 2d position of the game piece
- Returns:
- the 2d position of the game piece
-
getPose3d
Obtains a 3d pose of the game piece.
The 3d position is calculated from both the
getPoseOnField()
andzPositionSupplier
- Returns:
- the 3d position of the game piece
-
onIntake
-