accept slice in push_solve
This commit is contained in:
parent
77012d6caa
commit
ee9585a4c2
@ -808,7 +808,7 @@ impl TouchingState{
|
|||||||
a
|
a
|
||||||
}
|
}
|
||||||
fn constrain_velocity(&self,models:&PhysicsModels,hitbox_mesh:&HitboxMesh,velocity:Planar64Vec3)->Planar64Vec3{
|
fn constrain_velocity(&self,models:&PhysicsModels,hitbox_mesh:&HitboxMesh,velocity:Planar64Vec3)->Planar64Vec3{
|
||||||
let contacts=self.contacts.iter().map(|contact|{
|
let contacts:Vec<_>=self.contacts.iter().map(|contact|{
|
||||||
let n=contact_normal(models,hitbox_mesh,contact);
|
let n=contact_normal(models,hitbox_mesh,contact);
|
||||||
crate::push_solve::Contact{
|
crate::push_solve::Contact{
|
||||||
position:vec3::ZERO,
|
position:vec3::ZERO,
|
||||||
@ -819,7 +819,7 @@ impl TouchingState{
|
|||||||
crate::push_solve::push_solve(&contacts,velocity)
|
crate::push_solve::push_solve(&contacts,velocity)
|
||||||
}
|
}
|
||||||
fn constrain_acceleration(&self,models:&PhysicsModels,hitbox_mesh:&HitboxMesh,acceleration:Planar64Vec3)->Planar64Vec3{
|
fn constrain_acceleration(&self,models:&PhysicsModels,hitbox_mesh:&HitboxMesh,acceleration:Planar64Vec3)->Planar64Vec3{
|
||||||
let contacts=self.contacts.iter().map(|contact|{
|
let contacts:Vec<_>=self.contacts.iter().map(|contact|{
|
||||||
let n=contact_normal(models,hitbox_mesh,contact);
|
let n=contact_normal(models,hitbox_mesh,contact);
|
||||||
crate::push_solve::Contact{
|
crate::push_solve::Contact{
|
||||||
position:vec3::ZERO,
|
position:vec3::ZERO,
|
||||||
|
@ -289,7 +289,7 @@ fn get_best_push_ray_and_conts<'a>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_first_touch<'a>(contacts:&'a Vec<Contact>,ray:&Ray,conts:&Conts)->Option<(Ratio<Fixed<2,64>,Fixed<2,64>>,&'a Contact)>{
|
fn get_first_touch<'a>(contacts:&'a [Contact],ray:&Ray,conts:&Conts)->Option<(Ratio<Fixed<2,64>,Fixed<2,64>>,&'a Contact)>{
|
||||||
contacts.iter()
|
contacts.iter()
|
||||||
.filter(|&contact|
|
.filter(|&contact|
|
||||||
!conts.iter().any(|&c|std::ptr::eq(c,contact))
|
!conts.iter().any(|&c|std::ptr::eq(c,contact))
|
||||||
@ -299,7 +299,7 @@ fn get_first_touch<'a>(contacts:&'a Vec<Contact>,ray:&Ray,conts:&Conts)->Option<
|
|||||||
.min_by_key(|&(t,_)|t)
|
.min_by_key(|&(t,_)|t)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn push_solve(contacts:&Vec<Contact>,point:Planar64Vec3)->Planar64Vec3{
|
pub fn push_solve(contacts:&[Contact],point:Planar64Vec3)->Planar64Vec3{
|
||||||
let (mut ray,mut conts)=get_best_push_ray_and_conts_0(point);
|
let (mut ray,mut conts)=get_best_push_ray_and_conts_0(point);
|
||||||
loop{
|
loop{
|
||||||
let (next_t,next_cont)=match get_first_touch(contacts,&ray,&conts){
|
let (next_t,next_cont)=match get_first_touch(contacts,&ray,&conts){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user