forked from StrafesNET/strafe-client
fix constrain
This commit is contained in:
parent
432a38718c
commit
535ae1a5f0
@ -748,17 +748,21 @@ impl TouchingState{
|
|||||||
for contact in &self.contacts{
|
for contact in &self.contacts{
|
||||||
let (n,_)=models.mesh(contact.model_id).face_nd(contact.face_id);
|
let (n,_)=models.mesh(contact.model_id).face_nd(contact.face_id);
|
||||||
let d=n.dot(*velocity);
|
let d=n.dot(*velocity);
|
||||||
|
if d<Planar64::ZERO{
|
||||||
*velocity-=n*(d/n.dot(n));
|
*velocity-=n*(d/n.dot(n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fn constrain_acceleration(&self,models:&PhysicsModels,acceleration:&mut Planar64Vec3){
|
fn constrain_acceleration(&self,models:&PhysicsModels,acceleration:&mut Planar64Vec3){
|
||||||
//TODO: trey push solve
|
//TODO: trey push solve
|
||||||
for contact in &self.contacts{
|
for contact in &self.contacts{
|
||||||
let n=models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
let n=models.mesh(contact.model_id).face_nd(contact.face_id).0;
|
||||||
let d=n.dot(*acceleration);
|
let d=n.dot(*acceleration);
|
||||||
|
if d<Planar64::ZERO{
|
||||||
*acceleration-=n*(d/n.dot(n));
|
*acceleration-=n*(d/n.dot(n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fn get_move_state(&self,mut a:Planar64Vec3)->(MoveState,Planar64Vec3){
|
fn get_move_state(&self,mut a:Planar64Vec3)->(MoveState,Planar64Vec3){
|
||||||
//check current move conditions and use heuristics to determine
|
//check current move conditions and use heuristics to determine
|
||||||
//which ladder to climb on, which ground to walk on, etc
|
//which ladder to climb on, which ground to walk on, etc
|
||||||
|
Loading…
Reference in New Issue
Block a user