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
@@ -30,7 +30,7 @@ import type { World } from '../World';
|
||||
import type { Rapier } from '../physics/engine';
|
||||
import { PhysicsSystem } from '../physics/PhysicsSystem';
|
||||
import { CollisionSystem } from './CollisionSystem';
|
||||
import { bodyOf, type CollisionPair, type CollisionSource } from './solids';
|
||||
import { bodyOf, type CollisionPair, type CollisionSource, NOT_BLOCKED } from './solids';
|
||||
import { AnimationSystem } from './AnimationSystem';
|
||||
import type { Input } from './Input';
|
||||
import type { System } from './System';
|
||||
@@ -563,11 +563,11 @@ export class BehaviorSystem implements System {
|
||||
},
|
||||
moveAndSlide: (target, dx, dy) => {
|
||||
const found = resolve(target);
|
||||
if (!found) return { blockedX: false, blockedY: false };
|
||||
if (!found) return NOT_BLOCKED;
|
||||
if (this.collisions) return this.collisions.moveAndSlide(world, found, dx, dy);
|
||||
found.x += dx;
|
||||
found.y += dy;
|
||||
return { blockedX: false, blockedY: false };
|
||||
return NOT_BLOCKED;
|
||||
},
|
||||
physics:
|
||||
this.collisions instanceof PhysicsSystem
|
||||
|
||||
Reference in new issue
Block a user