normalize normal

This commit is contained in:
Quaternions 2023-11-06 19:09:54 -08:00
parent 2988175436
commit 1d2de93b9e

View File

@ -1064,7 +1064,7 @@ impl PhysicsState {
JumpDirection::FromContactNormal=>self.models.mesh(walk_state.contact.model_id).face_nd(walk_state.contact.face_id).0, JumpDirection::FromContactNormal=>self.models.mesh(walk_state.contact.model_id).face_nd(walk_state.contact.face_id).0,
&JumpDirection::Exactly(dir)=>dir, &JumpDirection::Exactly(dir)=>dir,
}; };
let mut v=self.body.velocity+n*self.style.get_jump_deltav(); let mut v=self.body.velocity+n*(self.style.get_jump_deltav()/n.length());
self.touching.constrain_velocity(&self.models,&mut v); self.touching.constrain_velocity(&self.models,&mut v);
self.body.velocity=v; self.body.velocity=v;
let moving_away=Planar64::ZERO<n.dot(v); let moving_away=Planar64::ZERO<n.dot(v);