Class RectCollider
java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.physics.collision.Collider
dev.prozilla.pine.core.component.physics.collision.RectCollider
- All Implemented Interfaces:
Destructible,Printable,ApplicationContext,ApplicationProvider,ComponentsContext,ComponentsProvider,EntityContext,EntityProvider,ColoredDrawable,Drawable,SceneContext,SceneProvider
An axis-aligned bounding box collider.
-
Field Summary
FieldsFields inherited from class dev.prozilla.pine.core.component.physics.collision.Collider
DEFAULT_COLOR, offset -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancollidesWith(CircleCollider other) booleancollidesWith(Collider other) Checks if this collider collides with another collider.booleancollidesWith(RectCollider other) voidDraws this collider in a given color.floatCalculates the y value of the bottom edge of this rectangle.Calculates the point at the center of this rectangle.floatCalculates the x value of the center of this rectangle.floatCalculates the y value of the center of this rectangle.floatgetLeft()Calculates the x value of the left edge of this rectangle.floatgetRight()Calculates the x value of the right edge of this rectangle.floatgetTop()Calculates the y value of the top edge of this rectangle.booleanisInside(float x, float y) Checks if a given point is inside this rectangle.booleanChecks if a given point is inside this rectangle.Methods inherited from class dev.prozilla.pine.core.component.physics.collision.Collider
draw, draw, draw, getOrigin, getOriginX, getOriginYMethods inherited from class dev.prozilla.pine.core.component.Component
destroy, equals, getApplication, getEntity, getName, getScene, hashCode, onEntityChange, setActive, setEntity, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.prozilla.pine.core.ApplicationProvider
getAudioDevice, getConfig, getInput, getLocalStorage, getLogger, getModManager, getRenderer, getTimer, getTracker, getWindowMethods inherited from interface dev.prozilla.pine.core.component.ComponentsProvider
getComponent, getComponentInParent, getComponentInParent, getComponents, getComponentsInChildrenMethods inherited from interface dev.prozilla.pine.core.entity.EntityContext
isDescendantOfMethods inherited from interface dev.prozilla.pine.core.entity.EntityProvider
getChild, getChildWithTag, getFirstChild, getLastChild, getParentWithTag, getTransform, isDescendantOfMethods inherited from interface dev.prozilla.pine.core.scene.SceneProvider
getCameraData, getWorld
-
Field Details
-
size
-
-
Constructor Details
-
RectCollider
-
RectCollider
-
-
Method Details
-
collidesWith
-
collidesWith
-
collidesWith
Description copied from class:ColliderChecks if this collider collides with another collider.- Overrides:
collidesWithin classCollider- Parameters:
other- The other collider- Returns:
trueif the colliders are colliding.
-
isInside
Checks if a given point is inside this rectangle.- Returns:
trueif the point is inside this rectangle.
-
isInside
public boolean isInside(float x, float y) Checks if a given point is inside this rectangle.- Parameters:
x- The x value of the pointy- The y value of the point- Returns:
trueif the point is inside this rectangle.
-
getCenter
Calculates the point at the center of this rectangle.- Returns:
- The point at the center of this rectangle.
-
getCenterX
public float getCenterX()Calculates the x value of the center of this rectangle.- Returns:
- The horizontal center of this rectangle.
-
getCenterY
public float getCenterY()Calculates the y value of the center of this rectangle.- Returns:
- The vertical center of this rectangle.
-
getRight
public float getRight()Calculates the x value of the right edge of this rectangle.- Returns:
- The maximum x value.
-
getLeft
public float getLeft()Calculates the x value of the left edge of this rectangle.- Returns:
- The minimum x value.
-
getTop
public float getTop()Calculates the y value of the top edge of this rectangle.- Returns:
- The maximum y value.
-
getBottom
public float getBottom()Calculates the y value of the bottom edge of this rectangle.- Returns:
- The minimum y value.
-
draw
Description copied from class:ColliderDraws this collider in a given color.- Specified by:
drawin interfaceColoredDrawable- Overrides:
drawin classCollider- Parameters:
renderer- The renderercolor- The color to draw withdepth- The depth of the entity
-