Move with collision reacts along the contact normal: it travels to the surface, stays flush and slides the rest of the move along it with Coulomb friction (the mean of both colliders, a tile counts as 0.5), a circle now rolls over an edge instead of catching on it, pushed dynamic bodies move off along the normal, Move gains the outputs hit, normal x and normal y, an object without its own collider moves freely, and editor run and play share the same path through Solids; contact point and normal come from our own f64 geometry (contactBetween), because Rapier's castShape lands 3e-6 px inside the wall in f32 (#150)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d931e66f92
commit
1b5e386b60
15 files changed
+680
-161
No files matched your search
@@ -26,6 +26,7 @@ import {
|
||||
bodyOf,
|
||||
type CollisionPair,
|
||||
type CollisionSource,
|
||||
type MoveResult,
|
||||
partsOf,
|
||||
shapeOf,
|
||||
Solids,
|
||||
@@ -169,12 +170,7 @@ export class PhysicsSystem implements System, CollisionSource {
|
||||
* `Move` with "Collide with solids": the object stops at what is in the way and slides along it,
|
||||
* as in the editor run, and a dynamic body that stops it gets a push (#147).
|
||||
*/
|
||||
moveAndSlide(
|
||||
world: World,
|
||||
entity: Entity,
|
||||
dx: number,
|
||||
dy: number,
|
||||
): { blockedX: boolean; blockedY: boolean } {
|
||||
moveAndSlide(world: World, entity: Entity, dx: number, dy: number): MoveResult {
|
||||
return this.solids.moveAndSlide(world, entity, dx, dy, (blocked) => this.push(world, entity, blocked));
|
||||
}
|
||||
|
||||
@@ -253,7 +249,7 @@ export class PhysicsSystem implements System, CollisionSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* A mover that runs into a dynamic body pushes it along its travel, as one body meeting another
|
||||
* A mover that runs into a dynamic body pushes it into the contact, as one body meeting another
|
||||
* without bounce: the wanted speed is the move spread over the frame, and a light mover barely
|
||||
* shifts a heavy crate. Both keep moving – the mover as the graph says, the crate as the engine does.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user