dummy
FreeBodyEngine.core.dummy
#
CircleCollisionShape(position, rotation, radius)
#
Bases: CollisionShape
A circular collision shape, defined by a center position and radius.
Stores the circle's position, rotation, and radius directly (rotation has no effect on a circle's shape, but is kept for a consistent CollisionShape interface).
position = position
instance-attribute
#
radius = radius
instance-attribute
#
rotation = rotation
instance-attribute
#
collide_circle(other)
#
Checks whether the two circles overlap by comparing the distance between their centers to the sum of their radii.
collide_point(point)
#
Checks whether point lies within the circle's radius.
collide_polygon(other)
#
Checks collision against a polygon by delegating to the polygon's own circle-collision test.
collide_rectangle(other)
#
Checks collision against a rectangle by delegating to the rectangle's own circle-collision test.
compute_mass(density)
#
A solid disk's mass is density * pi * r^2; its moment of
inertia about its own center is mass * r^2 / 2.
get_aabb()
#
The circle's bounding box: its position offset by radius on every side.
Collider2D(collision_shape_cls, position=Vector(), rotation=0, scale=Vector(1, 1))
#
Bases: Node2D
Base node for 2D colliders - wraps a CollisionShape and keeps it in sync with the node's world transform each update.
Creates the collision shape instance via collision_shape_cls(position, rotation, scale) - passing scale for whichever third parameter that shape class expects (size for RectangleCollisionShape). CircleCollider2D corrects this immediately afterward by overwriting collision_shape.radius, since a circle's constructor expects a radius, not a size vector.
collision_shape = collision_shape_cls(position, rotation, scale)
instance-attribute
#
apply_transform()
#
Copies the node's world transform onto the underlying collision shape's position/rotation/size.
collide(other)
#
Checks collision against another Collider2D by delegating to the underlying collision shapes.
on_update()
#
Keeps the collision shape's position/rotation/size in sync with the node's world transform every frame.
toggle_debug_visuals()
#
Adds or removes this collider's debug-visualization child node, depending on whether one is already present.
CollisionShape(position, rotation)
#
A Collision Shape. Contains logic for basic arcade collisions.
:param position: The position of the collider. :type position: Vector
No-op base initializer - concrete shapes (Circle/RectangleCollisionShape) set their own position/rotation/size attributes directly instead of calling this.
collide(other)
#
Checks collision with any collider object or point.
:param other: Checked object. :type other: Collider | Vector
:rtype: bool
collide_circle(other)
#
Checks for collision against a circle collider.
:param other: The checked collider. :type other: CircleCollider
:return bool: collision?
collide_point(point)
#
Checks for collision against a point.
:param point: The checked point. :type point: Vector
:rtype: bool
collide_polygon(other)
#
Checks for collision against a general convex polygon collider.
collide_rectangle(other)
#
Checks for collision against a rectangle collider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
RectangleCollider
|
The checked collider. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
collision? |
compute_mass(density)
#
Returns (mass, moment_of_inertia) for this shape at the given
density, both about this shape's own centroid - used by
RigidBody2D to auto-derive mass/inertia from its collider rather
than requiring them to be set by hand.
get_aabb()
#
Returns this shape's world-space axis-aligned bounding box as
(min, max) corners - used by the physics broad phase to cheaply
reject non-overlapping pairs before running real narrow-phase
collision.
RectangleCollisionShape(position, rotation, size)
#
Bases: CollisionShape
An oriented (rotatable) rectangular collision shape, defined by a center position, size, and rotation.
Stores the rectangle's position, size, and rotation directly.
position = position
instance-attribute
#
rotation = rotation
instance-attribute
#
size = size
instance-attribute
#
collide_circle(other)
#
Checks for overlap with a circle by clamping the circle's center onto the rectangle's bounds along each axis to find the closest point on the rectangle, then comparing that distance to the circle's radius.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the circle overlaps the rectangle. |
collide_point(point)
#
Checks whether point lies inside the rectangle by projecting it onto the rectangle's two (rotated) axes and testing against the rectangle's extent on each.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the point is inside the rectangle. |
collide_polygon(other)
#
Checks for overlap with a general convex polygon via SAT, treating this rectangle as its own 4-corner polygon.
collide_rectangle(other)
#
Checks for overlap with another rectangle using the separating axis theorem (SAT): tests both rectangles' face normals as candidate separating axes, and reports a collision only if no axis separates them.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the rectangles overlap. |
compute_mass(density)
#
A solid wxh box's mass is density * w * h; its moment of
inertia about its own center is mass * (w^2 + h^2) / 12.
get_aabb()
#
The rectangle's bounding box: the min/max of its (possibly rotated) corners.