You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Activity
lolgeny commentedon Mar 6, 2021
I'll try doing this as a first contribution
oxkitsune commentedon Mar 6, 2021
I think someone was working on this already, @Stoozy. I'm not sure how far they are but maybe you can collaborate?
lolgeny commentedon Mar 6, 2021
Oh ok, I'll do something else, I didn't know that
Stoozy commentedon Mar 8, 2021
Yea