edit jumped_velocity garbage

This commit is contained in:
Quaternions 2024-02-16 21:07:56 -08:00
parent 9396623f0c
commit efdb4c97be

View File

@ -1196,11 +1196,6 @@ fn get_walk_state(move_state:&MoveState)->Option<&WalkState>{
} }
} }
fn jumped_velocity(models:&PhysicsModels,style:&StyleModifiers,hitbox_mesh:&HitboxMesh,jump_dir:Planar64Vec3,v:&mut Planar64Vec3){
//bro what even is this function
*v=*v+jump_dir*(style.jump.get_jump_deltav()/jump_dir.length());
}
fn contact_normal(models:&PhysicsModels,hitbox_mesh:&HitboxMesh,contact:&ContactCollision)->Planar64Vec3{ fn contact_normal(models:&PhysicsModels,hitbox_mesh:&HitboxMesh,contact:&ContactCollision)->Planar64Vec3{
let model_mesh=models.mesh(contact.convex_mesh_id); let model_mesh=models.mesh(contact.convex_mesh_id);
let minkowski=model_physics::MinkowskiMesh::minkowski_sum(model_mesh,hitbox_mesh.transformed_mesh()); let minkowski=model_physics::MinkowskiMesh::minkowski_sum(model_mesh,hitbox_mesh.transformed_mesh());
@ -1406,10 +1401,13 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
None=>(), None=>(),
} }
let calc_move=if state.style.get_control(Controls::Jump,state.input_state.controls){ let calc_move=if state.style.get_control(Controls::Jump,state.input_state.controls){
if let Some(walk_state)=get_walk_state(&state.move_state){ state.style.jump.is_some_and(|jump_settings|{
jumped_velocity(&data.models,&state.style,&data.hitbox_mesh,walk_state.jump_direction.direction(&data.models,&data.hitbox_mesh,&walk_state.contact),&mut v); get_walk_state(&state.move_state).is_some_and(|walk_state|{
set_velocity_cull(&mut state.body,&mut state.touching,&data.models,&data.hitbox_mesh,v) let jump_dir=walk_state.jump_direction.direction(&data.models,&data.hitbox_mesh,&walk_state.contact);
}else{false} v=jump_settings.jumped_velocity(&state.style,jump_dir,v);
set_velocity_cull(&mut state.body,&mut state.touching,&data.models,&data.hitbox_mesh,v)
})
})
}else{false}; }else{false};
match &general.trajectory{ match &general.trajectory{
Some(trajectory)=>{ Some(trajectory)=>{
@ -1512,10 +1510,12 @@ fn run_teleport_behaviour(wormhole:&Option<gameplay_attributes::Wormhole>,models
PhysicsInputInstruction::SetJump(s)=>{ PhysicsInputInstruction::SetJump(s)=>{
state.input_state.set_control(Controls::Jump,s); state.input_state.set_control(Controls::Jump,s);
if let Some(walk_state)=get_walk_state(&state.move_state){ if let Some(walk_state)=get_walk_state(&state.move_state){
let mut v=state.body.velocity; if let Some(jump_settings)=&state.style.jump{
jumped_velocity(&data.models,&state.style,&data.hitbox_mesh,walk_state.jump_direction.direction(&data.models,&data.hitbox_mesh,&walk_state.contact),&mut v); let jump_dir=walk_state.jump_direction.direction(&data.models,&data.hitbox_mesh,&walk_state.contact);
if set_velocity_cull(&mut state.body,&mut state.touching,&data.models,&data.hitbox_mesh,v){ let jumped_velocity=jump_settings.jumped_velocity(&state.style,jump_dir,state.body.velocity);
(state.move_state,state.body.acceleration)=state.touching.get_move_state(&state.body,&data.models,&state.style,&data.hitbox_mesh,&state.camera,&state.input_state,state.time); if set_velocity_cull(&mut state.body,&mut state.touching,&data.models,&data.hitbox_mesh,jumped_velocity){
(state.move_state,state.body.acceleration)=state.touching.get_move_state(&state.body,&data.models,&state.style,&data.hitbox_mesh,&state.camera,&state.input_state,state.time);
}
} }
} }
b_refresh_walk_target=false; b_refresh_walk_target=false;