This commit is contained in:
2024-08-23 20:58:40 +02:00
parent 57a46db439
commit ad7b48d1fb
8 changed files with 137 additions and 15200 deletions

View File

@@ -6,7 +6,7 @@
namespace blitz {
class FirstPersonPlayer : public Player {
GDCLASS(FirstPersonPlayer, godot::CharacterBody3D)
GDCLASS(FirstPersonPlayer, godot::Node)
protected:
static void _bind_methods();
@@ -17,11 +17,10 @@ class FirstPersonPlayer : public Player {
// Godot overrides
void _unhandled_input(const godot::Ref<godot::InputEvent>&);
void _physics_process(float delta) override;
void _ready() override;
void _ready();
private:
godot::Camera3D* m_Camera;
godot::Node3D* m_Head;
float m_BobTime;
float m_Speed;
@@ -29,8 +28,6 @@ class FirstPersonPlayer : public Player {
void UpdateFOV(float delta);
void UpdateCamera(const godot::InputEventMouseMotion&);
void UpdatePosition(float delta);
void UpdateAnimation(float delta);
};
} // namespace blitz

View File

@@ -9,9 +9,9 @@ namespace blitz {
class World;
class Player : public godot::CharacterBody3D {
class Player : public godot::Node {
GDCLASS(Player, godot::CharacterBody3D);
GDCLASS(Player, godot::Node);
protected:
static void _bind_methods();
@@ -22,7 +22,13 @@ class Player : public godot::CharacterBody3D {
void _ready() override;
virtual void _physics_process(float delta);
void animate(float delta);
godot::Vector3 GetPosition() const;
void SetPosition(const godot::Vector3& a_Position);
godot::Vector3 GetVelocity() const;
void SetVelocity(const godot::Vector3& a_Velocity);
godot::Vector3 GetCameraRotation() const;
void SetCameraRotation(const godot::Vector3& a_Rotation);
@@ -33,11 +39,17 @@ class Player : public godot::CharacterBody3D {
protected:
godot::Node3D* m_Mesh;
godot::Node3D* m_Head;
godot::AnimationTree* m_AnimationTree;
godot::CharacterBody3D* m_Player;
godot::Vector3 m_SnapVector;
PeerID m_PeerId;
void SetModelVisible(bool visible);
void UpdateAnimation(float delta);
void BlendAnimation(const godot::String& a_AnimationName, float a_Goal, float a_Delta);
friend class World;
};
} // namespace blitz