74 lines
2 KiB
C++
74 lines
2 KiB
C++
#ifndef PLAYER_BODY_H
|
|
#define PLAYER_BODY_H
|
|
|
|
#include "scene/3d/camera_3d.h"
|
|
#include "scene/3d/physics/character_body_3d.h"
|
|
#include "scene/animation/animation_player.h"
|
|
|
|
class PlayerBody : public CharacterBody3D {
|
|
GDCLASS(PlayerBody, CharacterBody3D);
|
|
static void _bind_methods();
|
|
void _notification(int what);
|
|
void enter_tree();
|
|
void process(double delta);
|
|
void physics_process(double delta);
|
|
|
|
public:
|
|
Vector3 get_desired_direction() const;
|
|
Vector3 get_desired_velocity() const;
|
|
Vector2 get_movement_input() const;
|
|
|
|
AnimationPlayer *get_anim() const;
|
|
Camera3D *get_camera() const;
|
|
Node3D *get_model() const;
|
|
|
|
void set_stopping_deceleration(float value);
|
|
float get_stopping_deceleration() const;
|
|
void set_start_speed(float value);
|
|
float get_start_speed() const;
|
|
void set_step_boost(float value);
|
|
float get_step_boost() const;
|
|
void set_min_step_speed(float value);
|
|
float get_min_step_speed() const;
|
|
void set_acceleration(float value);
|
|
float get_acceleration() const;
|
|
void set_target_speed(float value);
|
|
float get_target_speed() const;
|
|
void set_split_step_time(double value);
|
|
double get_split_step_time() const;
|
|
void set_split_step_stop_time(double value);
|
|
double get_split_step_stop_time() const;
|
|
void set_model_lean(float value);
|
|
float get_model_lean() const;
|
|
void set_model_lean_speed(float value);
|
|
float get_model_lean_speed() const;
|
|
private:
|
|
Vector2 movement{0.f, 0.f};
|
|
|
|
AnimationPlayer *anim{nullptr};
|
|
Node3D *model{nullptr};
|
|
Camera3D *camera{nullptr};
|
|
|
|
float stopping_deceleration{20.f};
|
|
float start_speed{5.f};
|
|
float step_boost{7.f};
|
|
float min_step_speed{15.f};
|
|
float acceleration{8.f};
|
|
float target_speed{30.f};
|
|
double split_step_time{0.5};
|
|
double split_step_stop_time{0.5};
|
|
float max_speed_fov{100.f};
|
|
float min_fov{80.f};
|
|
double max_delta_fov{100.f};
|
|
float model_lean{0.25f};
|
|
float model_lean_speed{0.25f};
|
|
public:
|
|
static char *const split_step_action;
|
|
static char *const move_left_action;
|
|
static char *const move_right_action;
|
|
static char *const move_forward_action;
|
|
static char *const move_back_action;
|
|
};
|
|
|
|
#endif // !PLAYER_BODY_H
|