forked from StrafesNET/strafe-client
lol idk #1
@ -1124,15 +1124,16 @@ impl PhysicsContext{
|
|||||||
let mut aabb=aabb::Aabb::default();
|
let mut aabb=aabb::Aabb::default();
|
||||||
state.body.grow_aabb(&mut aabb,state.time,collector.time());
|
state.body.grow_aabb(&mut aabb,state.time,collector.time());
|
||||||
aabb.inflate(data.hitbox_mesh.halfsize);
|
aabb.inflate(data.hitbox_mesh.halfsize);
|
||||||
//common body
|
//relative to moving platforms
|
||||||
let relative_body=VirtualBody::relative(&Body::default(),&state.body).body(state.time);
|
//let relative_body=&VirtualBody::relative(&Body::default(),&state.body).body(state.time);
|
||||||
|
let relative_body=&state.body;
|
||||||
data.bvh.the_tester(&aabb,&mut |&convex_mesh_id|{
|
data.bvh.the_tester(&aabb,&mut |&convex_mesh_id|{
|
||||||
//no checks are needed because of the time limits.
|
//no checks are needed because of the time limits.
|
||||||
let model_mesh=data.models.mesh(convex_mesh_id);
|
let model_mesh=data.models.mesh(convex_mesh_id);
|
||||||
let minkowski=model_physics::MinkowskiMesh::minkowski_sum(model_mesh,data.hitbox_mesh.transformed_mesh());
|
let minkowski=model_physics::MinkowskiMesh::minkowski_sum(model_mesh,data.hitbox_mesh.transformed_mesh());
|
||||||
collector.collect(minkowski.predict_collision_in(&relative_body,collector.time())
|
collector.collect(minkowski.predict_collision_in(relative_body,collector.time())
|
||||||
//temp (?) code to avoid collision loops
|
//temp (?) code to avoid collision loops
|
||||||
.map_or(None,|(face,time)|if time==state.time{None}else{Some((face,time))})
|
.map_or(None,|(face,time)|if time<=state.time{None}else{Some((face,time))})
|
||||||
.map(|(face,time)|{
|
.map(|(face,time)|{
|
||||||
TimedInstruction{time,instruction:PhysicsInternalInstruction::CollisionStart(match data.models.attr(convex_mesh_id.model_id){
|
TimedInstruction{time,instruction:PhysicsInternalInstruction::CollisionStart(match data.models.attr(convex_mesh_id.model_id){
|
||||||
PhysicsCollisionAttributes::Contact{contacting:_,general:_}=>Collision::Contact(ContactCollision{convex_mesh_id,face_id:face}),
|
PhysicsCollisionAttributes::Contact{contacting:_,general:_}=>Collision::Contact(ContactCollision{convex_mesh_id,face_id:face}),
|
||||||
|
Loading…
Reference in New Issue
Block a user