group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
ViewmodelConfig.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
7
8#include <array>
9#include <cstddef>
10#include <glm/vec3.hpp>
11
14{
15 float scale;
17 float yawOffset, pitchOffset, rollOffset; // degrees
18};
19
22{
23 float scale;
24 glm::vec3 handOffset; // relative to player center (right, up, forward)
25 float yawOffset, pitchOffset, rollOffset; // degrees
26};
27
30{
31 const char* filename;
32 bool flipUVs;
33};
34
37{
38 float pitchKick = 3.0f;
39 float pushBack = 2.0f;
40 float rollKick = 1.0f;
41 float recoverySpeed = 12.0f;
42};
43
46{
47 static constexpr std::array<ViewmodelParams, 4> k_params{{
48 // Rifle (R-301) — existing tuning
49 {.scale = 0.03f,
50 .forward = 21.0f,
51 .right = 5.5f,
52 .down = 22.5f,
53 .yawOffset = 58.0f,
54 .pitchOffset = 12.0f,
55 .rollOffset = 2.0f},
56 // Rocket — fallback to R-301 tuning
57 {.scale = 0.03f,
58 .forward = 21.0f,
59 .right = 5.5f,
60 .down = 22.5f,
61 .yawOffset = 58.0f,
62 .pitchOffset = 12.0f,
63 .rollOffset = 2.0f},
64 // RailGun (Triple Take) — marksman
65 {.scale = 1.5f,
66 .forward = 38.0f,
67 .right = 15.0f,
68 .down = 16.5f,
69 .yawOffset = -9.0f,
70 .pitchOffset = 93.0f,
71 .rollOffset = -8.0f},
72 // EnergyGun (Wingman)
73 {.scale = 1.5f,
74 .forward = 23.5f,
75 .right = 11.5f,
76 .down = 12.0f,
77 .yawOffset = 2.0f,
78 .pitchOffset = 90.0f,
79 .rollOffset = 4.5f},
80 }};
81
82 return k_params[static_cast<std::size_t>(type)];
83}
84
87{
88 static const std::array<ThirdPersonWeaponParams, 4> k_params{{
89 // Rifle (R-301)
90 {.scale = 0.025f,
91 .handOffset = {1.5f, -3.5f, 14.0f},
92 .yawOffset = -47.0f,
93 .pitchOffset = 13.0f,
94 .rollOffset = 0.0f},
95 // Rocket — fallback to R-301
96 {.scale = 0.025f,
97 .handOffset = {1.5f, -3.5f, 14.0f},
98 .yawOffset = -47.0f,
99 .pitchOffset = 13.0f,
100 .rollOffset = 0.0f},
101 // RailGun (Triple Take)
102 {.scale = 1.0f, .handOffset = {7.5f, 7.5f, 15.0f}, .yawOffset = 0.0f, .pitchOffset = 96.0f, .rollOffset = 2.0f},
103 // EnergyGun (Wingman)
104 {.scale = 1.0f, .handOffset = {7.5f, 7.0f, 6.0f}, .yawOffset = 6.0f, .pitchOffset = 94.0f, .rollOffset = 0.0f},
105 }};
106
107 return k_params[static_cast<std::size_t>(type)];
108}
109
112{
113 static constexpr std::array<WeaponModelInfo, 4> k_infos{{
114 {.filename = "r-301_-_apex_legends.glb", .flipUVs = true}, // Rifle
115 {.filename = "r-301_-_apex_legends.glb", .flipUVs = true}, // Rocket (fallback)
116 {.filename = "apex_legends_triple_take_marksman.glb", .flipUVs = true}, // RailGun
117 {.filename = "apex_legends_wingman_pistol.glb", .flipUVs = true}, // EnergyGun
118 }};
119 return k_infos[static_cast<std::size_t>(type)];
120}
121
124{
125 static constexpr std::array<RecoilParams, 4> k_params{{
126 // Rifle (R-301) — full-auto, low per-shot, fast recovery
127 {.pitchKick = 2.0f, .pushBack = 1.5f, .rollKick = 0.5f, .recoverySpeed = 14.0f},
128 // Rocket — big boom
129 {.pitchKick = 8.0f, .pushBack = 5.0f, .rollKick = 2.0f, .recoverySpeed = 6.0f},
130 // RailGun (Triple Take) — medium
131 {.pitchKick = 5.0f, .pushBack = 3.0f, .rollKick = 1.0f, .recoverySpeed = 8.0f},
132 // EnergyGun (Wingman) — hand cannon
133 {.pitchKick = 6.0f, .pushBack = 4.0f, .rollKick = 1.5f, .recoverySpeed = 7.0f},
134 }};
135
136 return k_params[static_cast<std::size_t>(type)];
137}
Projectile component and weapon/surface type enumerations.
const ThirdPersonWeaponParams & getThirdPersonWeaponParams(WeaponType type)
Returns third-person weapon attachment params for remote players.
Definition ViewmodelConfig.hpp:86
const RecoilParams & getRecoilParams(WeaponType type)
Returns visual recoil params for a weapon type.
Definition ViewmodelConfig.hpp:123
const ViewmodelParams & getViewmodelParams(WeaponType type)
Returns viewmodel positioning params for a weapon type.
Definition ViewmodelConfig.hpp:45
WeaponModelInfo getWeaponModelInfo(WeaponType type)
Returns the GLB filename and load flags for a weapon type.
Definition ViewmodelConfig.hpp:111
WeaponType
Weapon type — determines tracer style, damage, sound, and impact effects.
Definition WeaponState.hpp:10
Visual recoil params per weapon type (viewmodel-only, does not affect aim).
Definition ViewmodelConfig.hpp:37
float rollKick
Degrees of random roll kick per shot.
Definition ViewmodelConfig.hpp:40
float recoverySpeed
Spring decay rate (higher = snappier recovery).
Definition ViewmodelConfig.hpp:41
float pitchKick
Degrees of upward pitch kick per shot.
Definition ViewmodelConfig.hpp:38
float pushBack
Quake units of backward push per shot.
Definition ViewmodelConfig.hpp:39
Third-person weapon attachment params for remote players.
Definition ViewmodelConfig.hpp:22
float scale
Definition ViewmodelConfig.hpp:23
glm::vec3 handOffset
Definition ViewmodelConfig.hpp:24
float rollOffset
Definition ViewmodelConfig.hpp:25
float pitchOffset
Definition ViewmodelConfig.hpp:25
float yawOffset
Definition ViewmodelConfig.hpp:25
First-person viewmodel positioning/rotation params per weapon type.
Definition ViewmodelConfig.hpp:14
float yawOffset
Definition ViewmodelConfig.hpp:17
float forward
Definition ViewmodelConfig.hpp:16
float scale
Definition ViewmodelConfig.hpp:15
float rollOffset
Definition ViewmodelConfig.hpp:17
float right
Definition ViewmodelConfig.hpp:16
float pitchOffset
Definition ViewmodelConfig.hpp:17
float down
Definition ViewmodelConfig.hpp:16
Asset filename + load flags for a weapon model.
Definition ViewmodelConfig.hpp:30
const char * filename
Definition ViewmodelConfig.hpp:31
bool flipUVs
Definition ViewmodelConfig.hpp:32