prevent arbitrary wall climbing

main
_ 2021-12-19 23:11:42 +00:00
parent 3916ff16da
commit 0052907432
2 changed files with 15 additions and 7 deletions

View File

@ -184,7 +184,7 @@ impl Graphics {
let world_model_mat = Mat4::IDENTITY;
self.passes [0].with (gl_state, || {
glezz::clear_color (0.5f32, 0.5f32, 0.5f32, 1.0f32);
glezz::clear_color (109f32 / 255.0, 194f32 / 255.0, 202f32 / 255.0, 1.0f32);
glezz::clear (gl::COLOR_BUFFER_BIT | gl::DEPTH_BUFFER_BIT | gl::STENCIL_BUFFER_BIT);
});
@ -192,6 +192,9 @@ impl Graphics {
let attrs = shader_vars.attrs;
let unis = shader_vars.unis;
glezz::uniform_3fv (unis [&u::ALBEDO], &white);
glezz::uniform_3fv (unis [&u::MIN_BRIGHT], &white);
if true {
self.texture_earth.bind ();
@ -354,7 +357,7 @@ impl Graphics {
}
}
if true {
if false {
let sky_mvp_mat = view_mat * Mat4::from_scale ((64.0, 64.0, 64.0).into ());
self.texture_sky.bind ();

View File

@ -150,7 +150,7 @@ async fn main () -> Result <()> {
let mut game_state = GameState::default ();
let phys_params = opengl_rust::physics::Params {
dt: 1.0 / 60.0,
gravity: (0.0, 0.0, -0.25).into (),
gravity: (0.0, 0.0, -0.5).into (),
margin: 0.00125,
};
@ -184,11 +184,16 @@ async fn main () -> Result <()> {
let kb_state = event_pump.keyboard_state ();
let player_speed = if player_jump_vec.is_some () {
let player_speed = if let Some (v) = player_jump_vec.as_ref () {
if v.z > 0.5 {
game_state.player.vel.x = 0.0;
game_state.player.vel.y = 0.0;
player_speed
}
else {
0.125
}
}
else {
0.125
};