group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
WeaponHoldPose.hpp File Reference

Authored per-weapon third-person hold pose (FK weapon-hold rewrite). More...

#include "ecs/components/GripPose.hpp"
#include <array>
#include <cstddef>
#include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp>
#include <string>
Include dependency graph for WeaponHoldPose.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ArmHoldPose
 One arm's authored 3-DOF FK pose. More...
struct  WeaponHoldPose
 Authored per-weapon third-person hold pose (see file header). More...

Functions

bool loadWeaponHoldPose (const std::string &path, WeaponHoldPose &out)
 Load a hold pose from a TOML side-table (see WeaponHoldPose.cpp for the schema).
bool saveWeaponHoldPose (const std::string &path, const WeaponHoldPose &pose)
 Save a hold pose to a TOML file (atomic temp-write + rename).

Variables

constexpr std::size_t kArmHoldBoneCount = 4
 Number of arm-chain bones the FK hold pose drives, ordered root → tip.
constexpr std::array< const char *, kArmHoldBoneCountkArmHoldBoneSuffixes
 Mixamo bone-name suffixes for the arm chain (prefixed with mixamorig:<Side> at runtime), ordered root → tip.
constexpr std::array< const char *, kArmHoldBoneCountkArmHoldBoneDisplayNames
 Human-readable labels for the arm-chain bones (tweaker UI).

Detailed Description

Authored per-weapon third-person hold pose (FK weapon-hold rewrite).

Replaces the old analytical two-bone arm IK + Spine2 hold-anchor system. The new model is dead simple and fully artist-/debug-tunable:

  • The weapon is a rigid CHILD of the upper-spine bone (mixamorig:Spine2). Its world transform is entityWorld × Spine2World × translate(spineOffset) × mat4(spineRotation) × scale.
  • The arms are pure forward kinematics. Each bone in the chain Shoulder → UpperArm → ForeArm → Hand — plus every finger joint — is posed by a single authored (pitch, yaw, roll) triple applied as a local rotation relative to the bone's rest pose. No solving, no targets: the hands (and therefore the whole arm) hang rigidly off the spine, so they follow the spine bend / aim pitch automatically.

Three rotation DOF per bone — pitch about local Z, yaw about local Y, roll (twist) about local X — give full control for accurate hand placement.

Function Documentation

◆ loadWeaponHoldPose()

bool loadWeaponHoldPose ( const std::string & path,
WeaponHoldPose & out )

Load a hold pose from a TOML side-table (see WeaponHoldPose.cpp for the schema).

Missing sections keep their default (zeroed) values; returns false only when the file cannot be parsed at all.

Here is the caller graph for this function:

◆ saveWeaponHoldPose()

bool saveWeaponHoldPose ( const std::string & path,
const WeaponHoldPose & pose )

Save a hold pose to a TOML file (atomic temp-write + rename).

Returns false on filesystem failure.

Variable Documentation

◆ kArmHoldBoneCount

std::size_t kArmHoldBoneCount = 4
inlineconstexpr

Number of arm-chain bones the FK hold pose drives, ordered root → tip.

◆ kArmHoldBoneDisplayNames

std::array<const char*, kArmHoldBoneCount> kArmHoldBoneDisplayNames
inlineconstexpr
Initial value:
{
"Shoulder (clavicle)", "Upper Arm", "Forearm", "Hand (wrist)"}

Human-readable labels for the arm-chain bones (tweaker UI).

◆ kArmHoldBoneSuffixes

std::array<const char*, kArmHoldBoneCount> kArmHoldBoneSuffixes
inlineconstexpr
Initial value:
{
"Shoulder", "Arm", "ForeArm", "Hand"}

Mixamo bone-name suffixes for the arm chain (prefixed with mixamorig:<Side> at runtime), ordered root → tip.