Module technology.sola.engine
Record Class ColliderShapeCircle
java.lang.Object
java.lang.Record
technology.sola.engine.physics.component.collider.ColliderShapeCircle
- Record Components:
radius
- the radius of the circle
- All Implemented Interfaces:
ColliderShape<Circle>
@NullMarked
public record ColliderShapeCircle(float radius)
extends Record
implements ColliderShape<Circle>
ColliderShapeCircle is a
Note: only
ColliderShape
implementation for a circle which utilize a
Circle
for its geometric shape representation.
Note: only
TransformComponent.getScaleX()
is used for size of collider-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance with radius set to 0.5f.ColliderShapeCircle
(float radius) Creates an instance of aColliderShapeCircle
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
debugRender
(Renderer renderer, TransformComponent transformComponent, float offsetX, float offsetY) Renders debug information for the collider shape.final boolean
Indicates whether some other object is "equal to" this one.getBoundingBox
(TransformComponent transformComponent, float offsetX, float offsetY) Returns the bounding box for thisColliderShape
.getShape
(TransformComponent transformComponent, float offsetX, float offsetY) Gets the geometricShape
for this collider shape.final int
hashCode()
Returns a hash code value for this object.float
radius()
Returns the value of theradius
record component.final String
toString()
Returns a string representation of this record class.type()
Gets theColliderType
of this collider.
-
Constructor Details
-
ColliderShapeCircle
public ColliderShapeCircle()Creates an instance with radius set to 0.5f. -
ColliderShapeCircle
public ColliderShapeCircle(float radius) Creates an instance of aColliderShapeCircle
record class.- Parameters:
radius
- the value for theradius
record component
-
-
Method Details
-
type
Description copied from interface:ColliderShape
Gets theColliderType
of this collider.- Specified by:
type
in interfaceColliderShape<Circle>
- Returns:
- the
ColliderType
of this collider
-
getBoundingBox
public Rectangle getBoundingBox(TransformComponent transformComponent, float offsetX, float offsetY) Description copied from interface:ColliderShape
Returns the bounding box for thisColliderShape
.- Specified by:
getBoundingBox
in interfaceColliderShape<Circle>
- Parameters:
transformComponent
- theTransformComponent
of the entityoffsetX
- the x offset of the collideroffsetY
- the y offset of the collider- Returns:
- the bounding box
-
getShape
Description copied from interface:ColliderShape
Gets the geometricShape
for this collider shape.- Specified by:
getShape
in interfaceColliderShape<Circle>
- Parameters:
transformComponent
- theTransformComponent
for theEntity
offsetX
- the x offset off the collideroffsetY
- the y offset of the collider- Returns:
- the geometric
Shape
-
debugRender
public void debugRender(Renderer renderer, TransformComponent transformComponent, float offsetX, float offsetY) Description copied from interface:ColliderShape
Renders debug information for the collider shape.- Specified by:
debugRender
in interfaceColliderShape<Circle>
- Parameters:
renderer
- theRenderer
transformComponent
- theEntity
'sTransformComponent
offsetX
- the collider shape x-axis offsetoffsetY
- the collider shape y-axis offset
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
radius
public float radius()Returns the value of theradius
record component.- Returns:
- the value of the
radius
record component
-