Crimson Engine 1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Loading...
Searching...
No Matches
IKSolver.hpp
Go to the documentation of this file.
1#pragma once
2#include <glm/glm.hpp>
3#include <string>
4#include <vector>
5
10enum class IKSolverType {
11 TwoBone, // Closed-form analytical solver for elbows/knees
12 FABRIK // Iterative solver for arbitrary joint chains (e.g. spine, tail)
13};
14
19// [ReflectClass]
22
23 // For 2-Bone Solver
24 // [ReflectField]
25 std::string startJointName; // e.g. "thigh.L"
26 // [ReflectField]
27 std::string middleJointName; // e.g. "shin.L"
28 // [ReflectField]
29 std::string endJointName; // e.g. "foot.L"
30
31 // For FABRIK Solver
32 std::vector<std::string> jointChainNames; // List of joint names from base to tip
33 // [ReflectField]
34 int maxIterations = 10;
35 // [ReflectField]
36 float tolerance = 0.001f;
37
38 // [ReflectField]
39 glm::vec3 targetPosition{ 0.0f }; // Target location in world space
40 // [ReflectField]
41 glm::vec3 polePosition{ 0.0f, 0.0f, 1.0f }; // bend helper vector
42
43 // [ReflectField]
44 float targetWeight = 1.0f; // Blend weight between raw FK (0.0) and IK (1.0)
45 // [ReflectField]
46 bool enabled = false;
47};
48
49
51REGISTER_COMPONENT(IKSolverComponent, "Animation/IK Solver");
52
53
#define REGISTER_COMPONENT(Type, MenuPath)
Definition ComponentReflection.hpp:156
IKSolverType
Selects the mathematics used to compute joint alignment.
Definition IKSolver.hpp:10
@ TwoBone
Definition IKSolver.hpp:11
@ FABRIK
Definition IKSolver.hpp:12
Specifies target joint chains and goal targets for analytical 2-Bone or iterative FABRIK IK.
Definition IKSolver.hpp:20
int maxIterations
Definition IKSolver.hpp:34
float tolerance
Definition IKSolver.hpp:36
std::string endJointName
Definition IKSolver.hpp:29
float targetWeight
Definition IKSolver.hpp:44
IKSolverType solverType
Definition IKSolver.hpp:21
glm::vec3 polePosition
Definition IKSolver.hpp:41
bool enabled
Definition IKSolver.hpp:46
glm::vec3 targetPosition
Definition IKSolver.hpp:39
std::vector< std::string > jointChainNames
Definition IKSolver.hpp:32
std::string middleJointName
Definition IKSolver.hpp:27
std::string startJointName
Definition IKSolver.hpp:25