-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Implement entity physics: gravity and collisions with blocks.
The basic algorithm for Minecraft entity physics is, each tick, to:
- Add velocity to position.
- For each axis (X/Y/Z) individually, check for collisions between the entity's bounding box and blocks. If there are any, clamp the entity's position to the edge of the block. There are some useful details on collision detection here, there I'm sure there are better sources.
- Apply gravity to velocity.
- Multiply velocity by a drag factor.
- For certain entities, steps 3 and 4 are swapped.
In Minecraft physics, different entities behave differently with different drag/gravity forces. This parameters are listed here. To implement this in Feather, we would use a Physics
component containing a field for each parameter: gravity_acceleration
, drag_factor
, bounding_box
, and drag_before_acceleration: bool
.
Some further guidance on implementing this: The Physics
struct should be defined in feather-common
, as should a physics_system
that uses a query to iterate over all entities with Physics
, Position
, and Velocity
components.
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers