43 lines
		
	
	
		
			990 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
		
			990 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#ifndef PLAYER_CAMERA_H
 | 
						|
#define PLAYER_CAMERA_H
 | 
						|
 | 
						|
#include "scene/3d/camera_3d.h"
 | 
						|
class PlayerBody;
 | 
						|
 | 
						|
class PlayerCamera : public Camera3D {
 | 
						|
	GDCLASS(PlayerCamera, Camera3D);
 | 
						|
	static void _bind_methods();
 | 
						|
	void on_look_input(Vector2 input);
 | 
						|
	void lead_weapon(Vector2 movement);
 | 
						|
	void update_fov();
 | 
						|
	void update_offset();
 | 
						|
	void ready();
 | 
						|
	void process(double delta);
 | 
						|
 | 
						|
protected:
 | 
						|
	void _notification(int what);
 | 
						|
 | 
						|
public:
 | 
						|
	void set_fov_factor(float value);
 | 
						|
	float get_fov_factor() const;
 | 
						|
 | 
						|
	void recoil(float r);
 | 
						|
 | 
						|
private:
 | 
						|
	float base_fov{ 60.f };
 | 
						|
	float fov_factor{ 1.0f };
 | 
						|
	Vector3 home{ 0, 0, 0 };
 | 
						|
	PlayerBody *body{ nullptr };
 | 
						|
	bool was_running{ false };
 | 
						|
	double run_bob_time{ 0.0 };
 | 
						|
	double run_bob_amplitude_weapon{ 0.025 };
 | 
						|
	double run_bob_amplitude_camera{ 0.045 };
 | 
						|
	double run_bob_frequency{ 12.0 };
 | 
						|
	double run_bob_blend_out{ 0.2 };
 | 
						|
	double weapon_lead_limit{ Math::PI * 0.009 };
 | 
						|
	double weapon_lead_speed{ 0.12 };
 | 
						|
	Vector3 weapon_lead_rotation{ 0, 0, 0 };
 | 
						|
};
 | 
						|
 | 
						|
#endif // !PLAYER_CAMERA_H
 |