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

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).

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
     
    static final double
     
    static final double
     
    static 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

    Constructors
    Constructor
    Description
    GamePieceOnFieldSimulation(String type, org.dyn4j.geometry.Convex shape, double gamePieceHeight, double mass, Translation2d initialPosition)
    Creates a Game Piece on the Field with Fixed Height.
    GamePieceOnFieldSimulation(String type, org.dyn4j.geometry.Convex shape, DoubleSupplier zPositionSupplier, double mass, Translation2d initialPosition, Translation2d initialVelocityMPS)
    Creates a Game Piece on the Field with Custom Height Supplier and Initial Velocity.
  • Method Summary

    Modifier and Type
    Method
    Description
    Obtains a 3d pose of the game piece.
    Obtains the 2d position of the game piece
    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

  • Constructor Details

    • GamePieceOnFieldSimulation

      public GamePieceOnFieldSimulation(String type, org.dyn4j.geometry.Convex shape, double gamePieceHeight, double mass, Translation2d initialPosition)

      Creates a Game Piece on the Field with Fixed Height.

      Parameters:
      type - the type of the game piece, affecting categorization within the arena
      shape - the shape of the collision space for the game piece
      gamePieceHeight - the height (thickness) of the game piece, in meters
      mass - the mass of the game piece, in kilograms
      initialPosition - the initial position of the game piece on the field
    • GamePieceOnFieldSimulation

      public GamePieceOnFieldSimulation(String type, org.dyn4j.geometry.Convex shape, DoubleSupplier zPositionSupplier, double mass, Translation2d initialPosition, Translation2d initialVelocityMPS)

      Creates a Game Piece on the Field with Custom Height Supplier and Initial Velocity.

      Parameters:
      type - the type of the game piece, affecting categorization within the arena
      shape - the shape of the collision space for the game piece
      zPositionSupplier - a supplier that provides the current Z-height of the game piece
      mass - the mass of the game piece, in kilograms
      initialPosition - the initial position of the game piece on the field
      initialVelocityMPS - the initial velocity of the game piece, in meters per second
  • Method Details

    • setVelocity

      public void setVelocity(ChassisSpeeds chassisSpeedsWorldFrame)

      Sets the world velocity of this game piece.

      Parameters:
      chassisSpeedsWorldFrame - the speeds of the game piece
    • getPoseOnField

      public Pose2d getPoseOnField()

      Obtains the 2d position of the game piece

      Returns:
      the 2d position of the game piece
    • getPose3d

      public Pose3d getPose3d()

      Obtains a 3d pose of the game piece.

      The 3d position is calculated from both the getPoseOnField() and zPositionSupplier

      Returns:
      the 3d position of the game piece