Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Two-body

Fixed constraint component (0 DOF).

Fixed constraint component (0 DOF)Welds two rigid bodies together, removing all relative motion. The bodies behave as a single rigid structure after connection.

Degrees of Freedom: 0 (all translation and rotation locked)

constraint:

// Create two entities with RigidBody components
auto bodyA = core.CreateEntity();
auto bodyB = core.CreateEntity();
// ... add transforms and rigid bodies ...
// Create fixed constraint between them
bodyA,
bodyB,
glm::vec3(0, -0.5f, 0), // Attachment point on bodyA (local space)
glm::vec3(0, 0.5f, 0), // Attachment point on bodyB (local space)
);
bodyA.AddComponent<Physics::Component::FixedConstraint>(core, constraint);
static ConstraintSettings Rigid()
Create settings for a perfectly rigid constraint.
Definition ConstraintSettings.hpp:136
Definition FixedConstraint.hpp:71
static FixedConstraint Create(Engine::EntityId a, Engine::EntityId b, const glm::vec3 &pointA=glm::vec3(0.0f), const glm::vec3 &pointB=glm::vec3(0.0f), const ConstraintSettings &constraintSettings=ConstraintSettings::Rigid())
Create a fixed constraint between two bodies.
Definition FixedConstraint.hpp:148