载入中...
搜索中...
未找到
FpsGait.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
6#include "common/Result.h"
7
8#include <cstdint>
9
10namespace eve::combat {
11
13enum class FpsGaitMode : std::uint8_t { Walk, Sprint, Crouch };
14
17 double walkSpeed = 5.5;
18 double sprintSpeed = 8.5;
19 double crouchSpeed = 2.8;
20 double standHeight = 1.80;
21 double crouchHeight = 1.10;
22 double standEyeHeight = 1.65;
23 double crouchEyeHeight = 0.95;
24 double capsuleRadius = 0.30;
25
27 [[nodiscard]] Result<void> validate() const;
28};
29
32 bool wantSprint = false;
33 bool wantCrouch = false;
34 bool grounded = true;
36 bool canStand = true;
37};
38
42 double moveSpeed = 0.0;
43 double capsuleHeight = 0.0;
44 double eyeHeight = 0.0;
45 double capsuleRadius = 0.0;
46};
47
56public:
58 [[nodiscard]] Result<void> setProfile(const FpsGaitProfile& profile);
59
61 [[nodiscard]] const FpsGaitProfile& profile() const { return profile_; }
62
64 [[nodiscard]] FpsGaitMode mode() const { return mode_; }
65
70 [[nodiscard]] Result<FpsGaitPose> evaluate(const FpsGaitInput& input);
71
72private:
73 FpsGaitProfile profile_{};
74 FpsGaitMode mode_ = FpsGaitMode::Walk;
75};
76
79 double stridePhase = 0.0;
80 double moveSpeed = 0.0;
81 double referenceSpeed = 5.5;
82 bool grounded = true;
83 bool enabled = true;
84 double amplitude = 0.035;
85 double landDip = 0.0;
86};
87
90 double eyeY = 0.0;
91};
92
98public:
100 [[nodiscard]] static Result<FpsHeadBobOffset> solve(const FpsHeadBobRequest& request);
101};
102
103} // namespace eve::combat
EvpackChunkInput input
Definition Evpack.cpp:170
#define EVENGINE_API_BACKENDS
Definition Export.h:108
const GltfImportRequest & request
Move-only, checked operation results for the common layer.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Deterministic Walk / Sprint / Crouch state machine.
Definition FpsGait.h:55
const FpsGaitProfile & profile() const
Current profile (defaults until setProfile succeeds).
Definition FpsGait.h:61
FpsGaitMode mode() const
Last committed mode.
Definition FpsGait.h:64
Parameterized first-person head bob (presentation only). @cost Cheap; O(1). Call after gait/move reso...
Definition FpsGait.h:97
FpsGaitMode
Discrete first-person locomotion gait.
Definition FpsGait.h:13
Per-frame intent and environment facts owned by the game.
Definition FpsGait.h:31
bool canStand
False when standing would collide (low ceiling); keeps crouch latched.
Definition FpsGait.h:36
Resolved gait pose for movers and cameras.
Definition FpsGait.h:40
Tunable speeds and capsule/eye heights for one FPS body.
Definition FpsGait.h:16
Result< void > validate() const
Reject non-finite or non-positive sizes/speeds.
Definition FpsGait.cpp:14
Eye-local vertical offset from bob + landing dip.
Definition FpsGait.h:89
Head-bob / landing dip inputs.
Definition FpsGait.h:78
double landDip
Remaining negative eye offset from landing.
Definition FpsGait.h:85
double stridePhase
Accumulated seconds * frequency scale.
Definition FpsGait.h:79
double moveSpeed
Horizontal speed this frame (m/s).
Definition FpsGait.h:80