载入中...
搜索中...
未找到
Coupling3DInternal.h
浏览该文件的文档.
1#pragma once
2// Internal step-local row representation; never exposed as a gameplay API.
3#include <box3d/box3d.h>
4#include <array>
7
8namespace eve::physics {
9namespace coupling_detail {
10struct Term {
12 b3Vec3 linear{}, angular{};
13};
14struct Row {
15 std::array<Term, 4> terms{};
16 int count = 0;
17 std::array<double, 2> coordinate{};
18 std::array<float, 2> wrapped{};
19 double error = 0;
20 bool active = true;
21 void add(PhysicsBodyHandle body, b3Vec3 linear, b3Vec3 angular, float scale);
22};
23[[nodiscard]] Result<void> validateResponse(World3D& world, const Row& row);
24} // namespace coupling_detail
26 World3D* world = nullptr;
27 int id = 0;
28 bool gear = false, enabled = true;
31 std::array<PhysicsJointHandle, 2> sources{};
32 std::array<PhysicsBodyHandle, 4> bodies{};
33 std::array<bool, 2> revolute{};
34 std::array<float, 2> previous{};
35 std::array<double, 2> coordinate{};
36 double reference = 0, lastImpulse = 0;
37 bool saturated = false;
38 [[nodiscard]] Result<coupling_detail::Row> row() const;
39 [[nodiscard]] const CouplingLimits3D& limits() const { return gear ? gearSettings.limits : pulleySettings.limits; }
40};
41} // namespace eve::physics
b3Vec3 angular
float linear
std::array< float, 3 > scale
Process-local, generation-qualified handles owned by the physics domain.
std::string body
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:47
Result< void > validateResponse(World3D &world, const Row &row)
Optional physics backend for vehicle mobility and body attach.
Definition Climbing.h:36
const CouplingLimits3D & limits() const
std::array< PhysicsBodyHandle, 4 > bodies
GearCoupling3DSettings gearSettings
std::array< PhysicsJointHandle, 2 > sources
std::array< float, 2 > previous
PulleyCoupling3DSettings pulleySettings
std::array< double, 2 > coordinate
Result< coupling_detail::Row > row() const
Stabilization and force limits for an ideal mechanical transmission.
Definition Coupling3D.h:16
Gear relation q1 + ratio*q2 = constant captured at creation. Mixed joints give ratio length-dependent...
Definition Coupling3D.h:23
Weighted rope length lA + ratio*lB; ideal taut pulley by default, optional tension-only slack rope.
Definition Coupling3D.h:28
void add(PhysicsBodyHandle body, b3Vec3 linear, b3Vec3 angular, float scale)