Fixed boundary collision behavior

This commit is contained in:
2025-09-05 14:16:43 -05:00
parent 47b3b9c46c
commit e974c95970

View File

@@ -115,8 +115,15 @@ impl Ship {
self.com_rotor = pos; self.com_rotor = pos;
self.vel = vel_2; self.vel = vel_2;
if self.intersects_circle(boundary) { if self.intersects_circle(boundary) {
self.com_rotor = 0.99*old; let pos = self.fixed_to_world(&gen_hyperbolic_point(&CGA::zero()));
//self.vel = CGA::zero(); let x = pos[E1];
let y = pos[E2];
let r_sqr = x*x+y*y;
let r = r_sqr.sqrt();
let clamp = x/r *CGA::e15() + y/r*CGA::e25();
let rotor = bivector_exponential(&(clamp*0.01));
self.com_rotor = rotor * old;
self.vel = CGA::zero();
} }
} }