CollidableEntity

model.entities.CollidableEntity

Combined trait for entities that are both collidable and have unique identifiers.

Represents simulation entities that can participate in collision detection and can be uniquely identified within the system.

Attributes

Graph
Supertypes
trait Entity
trait Collidable
trait Positioned
trait Sized
class Object
trait Matchable
class Any
Show all
Known subtypes

Members list

Value members

Inherited methods

Returns the bottom-left corner coordinates of this entity.

Returns the bottom-left corner coordinates of this entity.

Attributes

Returns

the position vector representing the bottom-left corner

Inherited from:
Collidable

Returns the bottom-right corner coordinates of this entity.

Returns the bottom-right corner coordinates of this entity.

Attributes

Returns

the position vector representing the bottom-right corner

Inherited from:
Collidable

Returns the center point of this entity's bounding rectangle.

Returns the center point of this entity's bounding rectangle.

Attributes

Returns

the position vector representing the geometric center

Inherited from:
Collidable
final def collidesWith[E <: Positioned](other: E): Boolean

Checks if this entity collides with another positioned entity.

Checks if this entity collides with another positioned entity.

Performs axis-aligned bounding box collision detection by checking for overlap on both horizontal and vertical axes. Both overlaps must be true for a collision to be detected.

Value parameters

other

the other positioned entity to check collision against

Attributes

Returns

true if the entities' bounding boxes overlap

Inherited from:
Collidable
final def contains(point: Vector2D): Boolean

Checks if a point is contained within this entity's bounds.

Checks if a point is contained within this entity's bounds.

Uses inclusive bounds checking on the left and top edges, and exclusive on the right and bottom edges to prevent edge overlap issues.

Value parameters

point

the 2D point to test for containment

Attributes

Returns

true if the point is within this entity's rectangular bounds

Inherited from:
Collidable

Returns the top-left corner coordinates of this entity.

Returns the top-left corner coordinates of this entity.

Attributes

Returns

the position vector representing the top-left corner

Inherited from:
Collidable

Returns the top-right corner coordinates of this entity.

Returns the top-right corner coordinates of this entity.

Attributes

Returns

the position vector representing the top-right corner

Inherited from:
Collidable
def vertices: Seq[Vector2D]

Returns all four corner vertices of this entity's bounding rectangle.

Returns all four corner vertices of this entity's bounding rectangle.

Attributes

Returns

sequence containing topLeft, topRight, bottomLeft, and bottomRight vertices

Inherited from:
Collidable

Inherited and Abstract fields

val height: Double

Attributes

Inherited from:
Sized
val id: String

Attributes

Inherited from:
Entity

Attributes

Inherited from:
Positioned
val width: Double

Attributes

Inherited from:
Sized