fix hitbox size
This commit is contained in:
@@ -1226,10 +1226,9 @@ impl GraphicsState{
|
||||
*/
|
||||
|
||||
// update hitbox mesh transform
|
||||
if let Some(debug_hitbox_position)=&frame_state.debug_hitbox_position{
|
||||
let transform=glam::Mat4::from_translation(glam::Vec3::from_array(debug_hitbox_position.to_array().map(Into::into)));
|
||||
if let Some(debug_hitbox_position)=frame_state.debug_hitbox_position{
|
||||
let model_uniforms=get_instances_buffer_data(&[GraphicsModelOwned{
|
||||
transform,
|
||||
transform:debug_hitbox_position.into(),
|
||||
normal_transform:glam::Mat3::IDENTITY,
|
||||
color:GraphicsModelColor4::new(glam::vec4(1.0,0.0,0.0,0.2)),
|
||||
}]);
|
||||
|
||||
@@ -1200,6 +1200,9 @@ impl PhysicsData{
|
||||
modes,
|
||||
}
|
||||
}
|
||||
pub fn vertex_transform(&self)->&integer::Planar64Affine3{
|
||||
&self.hitbox_mesh.transform.vertex
|
||||
}
|
||||
}
|
||||
// the collection of information required to run physics
|
||||
pub struct PhysicsContext<'a>{
|
||||
|
||||
@@ -62,7 +62,7 @@ pub struct FrameState{
|
||||
pub camera:physics::PhysicsCamera,
|
||||
pub time:PhysicsTime,
|
||||
pub hit:Option<Hit>,
|
||||
pub debug_hitbox_position:Option<strafesnet_common::integer::Planar64Vec3>,
|
||||
pub debug_hitbox_position:Option<strafesnet_common::integer::Planar64Affine3>,
|
||||
}
|
||||
|
||||
pub struct Simulation{
|
||||
@@ -83,7 +83,7 @@ impl Simulation{
|
||||
&self,
|
||||
time:SessionTime,
|
||||
debug_model:Option<Hit>,
|
||||
debug_hitbox_position:Option<strafesnet_common::integer::Planar64Vec3>,
|
||||
debug_hitbox_position:Option<strafesnet_common::integer::Planar64Affine3>,
|
||||
)->FrameState{
|
||||
FrameState{
|
||||
body:self.physics.camera_body(),
|
||||
@@ -226,9 +226,10 @@ impl Session{
|
||||
self.geometry_shared=PhysicsData::new(map);
|
||||
}
|
||||
pub fn get_frame_state(&self,time:SessionTime)->Option<FrameState>{
|
||||
let debug_hitbox_position=self.debug_simulation.as_ref().map(|debug_simulation|
|
||||
debug_simulation.physics.body().position
|
||||
);
|
||||
let debug_hitbox_position=self.debug_simulation.as_ref().map(|debug_simulation|{
|
||||
let transform=self.geometry_shared.vertex_transform();
|
||||
strafesnet_common::integer::Planar64Affine3::new(transform.matrix3,debug_simulation.physics.body().position)
|
||||
});
|
||||
match &self.view_state{
|
||||
ViewState::Play=>Some(self.simulation.get_frame_state(time,self.last_ray_hit.clone(),debug_hitbox_position)),
|
||||
ViewState::Replay(bot_id)=>self.replays.get(bot_id).map(|replay|
|
||||
|
||||
Reference in New Issue
Block a user