diff --git a/ClassicalSharp/Entities/AnimatedEntity.cs b/ClassicalSharp/Entities/AnimatedEntity.cs index 21aa42cb2..2ea2f5c94 100644 --- a/ClassicalSharp/Entities/AnimatedEntity.cs +++ b/ClassicalSharp/Entities/AnimatedEntity.cs @@ -49,7 +49,7 @@ namespace ClassicalSharp { legXRot = -(float)(Math.Cos( walkTime ) * swing * legMax); armZRot = -idleZRot; - bobYOffset = (float)(Math.Abs( Math.Cos( walkTime ) ) * swing * (3/16f)); + bobYOffset = (float)(Math.Abs( Math.Cos( walkTime ) ) * swing * (2.5f/16f)); tilt = (float)Math.Cos( walkTime ) * swing * (0.15f * Utils.Deg2Rad); if( Model is PlayerModel ) CalcHumanAnim( idleXRot, idleZRot ); diff --git a/ClassicalSharp/Rendering/StandardEnvRenderer.cs b/ClassicalSharp/Rendering/StandardEnvRenderer.cs index 106d6ffc5..1a38e2eb0 100644 --- a/ClassicalSharp/Rendering/StandardEnvRenderer.cs +++ b/ClassicalSharp/Rendering/StandardEnvRenderer.cs @@ -122,13 +122,21 @@ namespace ClassicalSharp.Renderers { void ResetFog() { if( map.IsNotLoaded ) return; FastColour adjFogCol = FastColour.White; - Block headBlock = game.LocalPlayer.BlockAtHead; BlockInfo info = game.BlockInfo; + BoundingBox pBounds = game.LocalPlayer.CollisionBounds; - if( info.FogDensity[(byte)headBlock] != 0 ) { + Vector3I headCoords = Vector3I.Floor( game.LocalPlayer.EyePosition ); + Vector3 pos = (Vector3)headCoords; + byte headBlock = game.Map.SafeGetBlock( headCoords ); + BoundingBox blockBB = new BoundingBox( pos + game.BlockInfo.MinBB[headBlock], + pos + game.BlockInfo.MaxBB[headBlock] ); + BoundingBox localBB = game.LocalPlayer.CollisionBounds; + bool intersecting = blockBB.Intersects( localBB ); + + if( intersecting && info.FogDensity[headBlock] != 0 ) { graphics.SetFogMode( Fog.Exp ); - graphics.SetFogDensity( info.FogDensity[(byte)headBlock] ); - adjFogCol = info.FogColour[(byte)headBlock]; + graphics.SetFogDensity( info.FogDensity[headBlock] ); + adjFogCol = info.FogColour[headBlock]; } else { // Blend fog and sky together float blend = (float)BlendFactor( game.ViewDistance );