collision_set¶
- class CollisionSet( )¶
An abstraction layer that allows for testing intersections between arbitrary types and numbers of shapes. Used primarily for issuing warnings when Entity objects are placed such that they overlap each other in ways that would not be permitted in game. Almost all entities use a single AABB, but this class allows for more handling more complex collisions for rail entities and others.
- get_bounding_box() AABB¶
Gets the minimum-bounding AABB for this
CollisionSet.- Returns:
An
AABBwith the maximal dimensions for thisCollisionSet, orNoneif thisCollisionSethas no shapes.
- overlaps(other: CollisionSet) bool¶
Checks to see if any of this
CollisionSetshapesintersect any part ofother’sshapes.- Parameters:
- other: CollisionSet¶
The other
CollisionSetto test against.
- Returns:
Trueif they overlap,Falseif they do not.
- rotate(amt: int) CollisionSet¶
Rotates all
shapeswithin thisCollisionSetbyamt, whereamtis in increments of 45 degrees. Contsructs a new collision set with the rotated shapes.- Parameters:
- amt: int¶
The amount to rotate as multiples of 45 degrees.
- Returns:
A new
CollisionSetwith the rotated contents.