mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 09:15:29 +01:00 
			
		
		
		
	Simple fix for camera blinking black when jumping into ceiling with current smaller collision box
This commit is contained in:
		@@ -40,6 +40,7 @@ Player::Player(IGameDef *gamedef):
 | 
			
		||||
	in_water_stable(false),
 | 
			
		||||
	is_climbing(false),
 | 
			
		||||
	swimming_up(false),
 | 
			
		||||
	camera_barely_in_ceiling(false),
 | 
			
		||||
	inventory(gamedef->idef()),
 | 
			
		||||
	hp(PLAYER_MAX_HP),
 | 
			
		||||
	peer_id(PEER_ID_INEXISTENT),
 | 
			
		||||
@@ -604,6 +605,17 @@ void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d,
 | 
			
		||||
		MtEvent *e = new SimpleTriggerEvent("PlayerRegainGround");
 | 
			
		||||
		m_gamedef->event()->put(e);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	{
 | 
			
		||||
		camera_barely_in_ceiling = false;
 | 
			
		||||
		v3s16 camera_np = floatToInt(getEyePosition(), BS);
 | 
			
		||||
		MapNode n = map.getNodeNoEx(camera_np);
 | 
			
		||||
		if(n.getContent() != CONTENT_IGNORE){
 | 
			
		||||
			if(nodemgr->get(n).walkable){
 | 
			
		||||
				camera_barely_in_ceiling = true;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void LocalPlayer::move(f32 dtime, Map &map, f32 pos_max_d)
 | 
			
		||||
 
 | 
			
		||||
@@ -66,9 +66,12 @@ public:
 | 
			
		||||
	v3f getEyeOffset()
 | 
			
		||||
	{
 | 
			
		||||
		// This is at the height of the eyes of the current figure
 | 
			
		||||
		// return v3f(0, BS+BS/2, 0);
 | 
			
		||||
		// return v3f(0, BS*1.5, 0);
 | 
			
		||||
		// This is more like in minecraft
 | 
			
		||||
		return v3f(0,BS+(5*BS)/8,0);
 | 
			
		||||
		if(camera_barely_in_ceiling)
 | 
			
		||||
			return v3f(0,BS*1.5,0);
 | 
			
		||||
		else
 | 
			
		||||
			return v3f(0,BS*1.625,0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	v3f getEyePosition()
 | 
			
		||||
@@ -143,6 +146,7 @@ public:
 | 
			
		||||
	bool in_water_stable;
 | 
			
		||||
	bool is_climbing;
 | 
			
		||||
	bool swimming_up;
 | 
			
		||||
	bool camera_barely_in_ceiling;
 | 
			
		||||
	
 | 
			
		||||
	u8 light;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user