vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
solver.h
1#pragma once
2
3#include <vector>
4
5#include <glm/glm.hpp>
6#include <glm/gtc/quaternion.hpp>
7
8#include "system/physics/collision/contact.h"
9
10namespace Vkm::Engine {
11
12struct JointConstraint;
13
21 glm::vec3 position = {0.0f, 0.0f, 0.0f};
22
29 glm::quat rotation = {1.0f, 0.0f, 0.0f, 0.0f};
30
31 glm::vec3 linearVelocity = {0.0f, 0.0f, 0.0f};
32 glm::vec3 angularVelocity = {0.0f, 0.0f, 0.0f};
33
34 glm::mat3 invInertiaWorld = glm::mat3(0.0f);
35 float invMass = 0.0f;
36
37 float restitution = 0.2f;
38 float friction = 0.5f;
39};
40
48 int iterations = 0;
49 float dt = 0.0f;
50};
51
72void solveStep(
73 std::vector<PhysicsBody>& bodies,
74 std::vector<ContactManifold>& manifolds,
75 std::vector<JointConstraint>& joints,
76 const SolverParams& params
77);
78
79} // namespace Vkm::Engine
One joint, resolved to the two solver bodies it constrains.
Definition joint_solver.h:19
Per-tick dynamic state the solver reads and writes, by index.
Definition solver.h:20
glm::mat3 invInertiaWorld
R * I_local^-1 * R^T for this tick.
Definition solver.h:34
glm::vec3 position
Body origin (entity world position)
Definition solver.h:21
glm::quat rotation
World orientation, as gathered and then as integrated.
Definition solver.h:29
float invMass
0 == not moved by this solve
Definition solver.h:35
What the solver is told about the step it is solving.
Definition solver.h:47
float dt
Fixed timestep, in seconds, from the clock.
Definition solver.h:49
int iterations
PGS passes per tick, from PhysicsSettings::solverIterations.
Definition solver.h:48