Fixed boundary collision behavior
This commit is contained in:
11
src/lib.rs
11
src/lib.rs
@@ -115,8 +115,15 @@ impl Ship {
|
||||
self.com_rotor = pos;
|
||||
self.vel = vel_2;
|
||||
if self.intersects_circle(boundary) {
|
||||
self.com_rotor = 0.99*old;
|
||||
//self.vel = CGA::zero();
|
||||
let pos = self.fixed_to_world(&gen_hyperbolic_point(&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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user