载入中...
搜索中...
未找到
JointBackend3D.h
浏览该文件的文档.
1#pragma once
2#include <array>
3#include "common/Result.h"
4
5namespace eve::physics {
6class Joint3D;
9 std::array<float, 7> bodyA{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f};
10 std::array<float, 7> bodyB{0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f};
11};
24public:
28 virtual void bindOwner(Joint3D& owner) noexcept = 0;
29 virtual ~IJointBackend3D() = default;
31 virtual bool isValid() const noexcept = 0;
33 virtual void destroy() noexcept = 0;
35 virtual void invalidate() noexcept = 0;
37 [[nodiscard]] virtual eve::Result<JointFrames3D> localFrames() const = 0;
39 [[nodiscard]] virtual eve::Result<void> setCollideConnected(bool collide) = 0;
41 [[nodiscard]] virtual eve::Result<bool> getCollideConnected() const = 0;
43 [[nodiscard]] virtual eve::Result<void> setForceThreshold(float threshold) = 0;
45 [[nodiscard]] virtual eve::Result<float> getForceThreshold() const = 0;
47 [[nodiscard]] virtual eve::Result<void> setTorqueThreshold(float threshold) = 0;
49 [[nodiscard]] virtual eve::Result<float> getTorqueThreshold() const = 0;
51 [[nodiscard]] virtual eve::Result<float> getConstraintForceX() const = 0;
53 [[nodiscard]] virtual eve::Result<float> getConstraintForceY() const = 0;
55 [[nodiscard]] virtual eve::Result<float> getConstraintForceZ() const = 0;
57 [[nodiscard]] virtual eve::Result<float> getConstraintTorqueX() const = 0;
59 [[nodiscard]] virtual eve::Result<float> getConstraintTorqueY() const = 0;
61 [[nodiscard]] virtual eve::Result<float> getConstraintTorqueZ() const = 0;
63 [[nodiscard]] virtual eve::Result<float> getLinearSeparation() const = 0;
65 [[nodiscard]] virtual eve::Result<float> getAngularSeparation() const = 0;
67 [[nodiscard]] virtual eve::Result<void> setDistanceLength(float length) = 0;
69 [[nodiscard]] virtual eve::Result<float> getDistanceLength() const = 0;
71 [[nodiscard]] virtual eve::Result<float> getDistanceCurrentLength() const = 0;
73 [[nodiscard]] virtual eve::Result<void> setDistanceSpring(bool enabled, float hertz, float dampingRatio) = 0;
75 [[nodiscard]] virtual eve::Result<void> setDistanceLimits(bool enabled, float minimum, float maximum) = 0;
77 [[nodiscard]] virtual eve::Result<void> setDistanceMotor(bool enabled, float speed, float maxForce) = 0;
79 [[nodiscard]] virtual eve::Result<void> setRevoluteSpring(bool enabled, float targetAngle, float hertz,
80 float dampingRatio) = 0;
82 [[nodiscard]] virtual eve::Result<void> setRevoluteLimits(bool enabled, float lower, float upper) = 0;
84 [[nodiscard]] virtual eve::Result<void> setRevoluteMotor(bool enabled, float speed, float maxTorque) = 0;
86 [[nodiscard]] virtual eve::Result<float> getRevoluteAngle() const = 0;
88 [[nodiscard]] virtual eve::Result<float> getRevoluteMotorTorque() const = 0;
90 [[nodiscard]] virtual eve::Result<void> setPrismaticSpring(bool enabled, float targetTranslation, float hertz,
91 float dampingRatio) = 0;
93 [[nodiscard]] virtual eve::Result<void> setPrismaticLimits(bool enabled, float lower, float upper) = 0;
95 [[nodiscard]] virtual eve::Result<void> setPrismaticMotor(bool enabled, float speed, float maxForce) = 0;
97 [[nodiscard]] virtual eve::Result<float> getPrismaticTranslation() const = 0;
99 [[nodiscard]] virtual eve::Result<float> getPrismaticSpeed() const = 0;
101 [[nodiscard]] virtual eve::Result<float> getPrismaticMotorForce() const = 0;
103 [[nodiscard]] virtual eve::Result<void> setSphericalConeLimit(bool enabled, float angle) = 0;
105 [[nodiscard]] virtual eve::Result<void> setSphericalTwistLimits(bool enabled, float lower, float upper) = 0;
107 [[nodiscard]] virtual eve::Result<void> setSphericalMotor(bool enabled, float velocityX, float velocityY,
108 float velocityZ, float maxTorque) = 0;
110 [[nodiscard]] virtual eve::Result<float> getSphericalConeAngle() const = 0;
112 [[nodiscard]] virtual eve::Result<float> getSphericalTwistAngle() const = 0;
114 [[nodiscard]] virtual eve::Result<void> setWheelSuspension(bool enabled, float hertz, float dampingRatio) = 0;
116 [[nodiscard]] virtual eve::Result<void> setWheelSuspensionLimits(bool enabled, float lower, float upper) = 0;
118 [[nodiscard]] virtual eve::Result<void> setWheelSpinMotor(bool enabled, float speed, float maxTorque) = 0;
120 [[nodiscard]] virtual eve::Result<void> setWheelSteering(bool enabled, float targetAngle, float hertz,
121 float dampingRatio, float maxTorque) = 0;
123 [[nodiscard]] virtual eve::Result<void> setWheelSteeringLimits(bool enabled, float lower, float upper) = 0;
125 [[nodiscard]] virtual eve::Result<float> getWheelSpinSpeed() const = 0;
127 [[nodiscard]] virtual eve::Result<float> getWheelSpinTorque() const = 0;
129 [[nodiscard]] virtual eve::Result<float> getWheelSteeringAngle() const = 0;
131 [[nodiscard]] virtual eve::Result<float> getWheelSteeringTorque() const = 0;
133 [[nodiscard]] virtual eve::Result<void> setWeldLinearSpring(float hertz, float dampingRatio) = 0;
135 [[nodiscard]] virtual eve::Result<void> setWeldAngularSpring(float hertz, float dampingRatio) = 0;
137 [[nodiscard]] virtual eve::Result<float> getWeldLinearHertz() const = 0;
139 [[nodiscard]] virtual eve::Result<float> getWeldLinearDampingRatio() const = 0;
141 [[nodiscard]] virtual eve::Result<float> getWeldAngularHertz() const = 0;
143 [[nodiscard]] virtual eve::Result<float> getWeldAngularDampingRatio() const = 0;
145 [[nodiscard]] virtual eve::Result<void> setMotorLinearVelocity(float vx, float vy, float vz) = 0;
147 [[nodiscard]] virtual eve::Result<void> setMotorAngularVelocity(float wx, float wy, float wz) = 0;
149 [[nodiscard]] virtual eve::Result<void> setMotorVelocityLimits(float maxForce, float maxTorque) = 0;
151 [[nodiscard]] virtual eve::Result<void> setMotorLinearSpring(float hertz, float dampingRatio, float maxForce) = 0;
153 [[nodiscard]] virtual eve::Result<void> setMotorAngularSpring(float hertz, float dampingRatio, float maxTorque) = 0;
155 [[nodiscard]] virtual eve::Result<float> getMotorLinearVelocityX() const = 0;
157 [[nodiscard]] virtual eve::Result<float> getMotorLinearVelocityY() const = 0;
159 [[nodiscard]] virtual eve::Result<float> getMotorLinearVelocityZ() const = 0;
161 [[nodiscard]] virtual eve::Result<float> getMotorAngularVelocityX() const = 0;
163 [[nodiscard]] virtual eve::Result<float> getMotorAngularVelocityY() const = 0;
165 [[nodiscard]] virtual eve::Result<float> getMotorAngularVelocityZ() const = 0;
167 [[nodiscard]] virtual eve::Result<void> setParallelSpring(float hertz, float dampingRatio, float maxTorque) = 0;
169 [[nodiscard]] virtual eve::Result<float> getParallelHertz() const = 0;
171 [[nodiscard]] virtual eve::Result<float> getParallelDampingRatio() const = 0;
173 [[nodiscard]] virtual eve::Result<float> getParallelMaxTorque() const = 0;
174};
175} // namespace eve::physics
float maxForce
float maximum[3]
float minimum[3]
float dampingRatio
float length
std::shared_ptr< OceanGpuSpectrum > owner
Move-only, checked operation results for the common layer.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
Solver-independent control of one constraint, owned exclusively by its Joint3D facade....
virtual eve::Result< void > setRevoluteMotor(bool enabled, float speed, float maxTorque)=0
setRevoluteMotor; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getMotorLinearVelocityY() const =0
getMotorLinearVelocityY; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getForceThreshold() const =0
getForceThreshold; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getParallelHertz() const =0
getParallelHertz; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getWeldAngularDampingRatio() const =0
getWeldAngularDampingRatio; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getWeldAngularHertz() const =0
getWeldAngularHertz; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getConstraintTorqueX() const =0
getConstraintTorqueX; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getLinearSeparation() const =0
getLinearSeparation; see the class lifetime, validation and failure contract.
virtual eve::Result< JointFrames3D > localFrames() const =0
localFrames; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getWheelSteeringTorque() const =0
getWheelSteeringTorque; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getWheelSpinSpeed() const =0
getWheelSpinSpeed; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getRevoluteAngle() const =0
getRevoluteAngle; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getWheelSpinTorque() const =0
getWheelSpinTorque; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getSphericalConeAngle() const =0
getSphericalConeAngle; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setSphericalMotor(bool enabled, float velocityX, float velocityY, float velocityZ, float maxTorque)=0
setSphericalMotor; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getPrismaticMotorForce() const =0
getPrismaticMotorForce; see the class lifetime, validation and failure contract.
virtual eve::Result< bool > getCollideConnected() const =0
getCollideConnected; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setWheelSuspensionLimits(bool enabled, float lower, float upper)=0
setWheelSuspensionLimits; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getAngularSeparation() const =0
getAngularSeparation; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setWheelSteeringLimits(bool enabled, float lower, float upper)=0
setWheelSteeringLimits; see the class lifetime, validation and failure contract.
virtual void invalidate() noexcept=0
Detaches before the parent destroys its constraints; no failure or callbacks.
virtual eve::Result< void > setPrismaticSpring(bool enabled, float targetTranslation, float hertz, float dampingRatio)=0
setPrismaticSpring; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setMotorAngularSpring(float hertz, float dampingRatio, float maxTorque)=0
setMotorAngularSpring; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setCollideConnected(bool collide)=0
setCollideConnected; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setPrismaticMotor(bool enabled, float speed, float maxForce)=0
setPrismaticMotor; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getDistanceCurrentLength() const =0
getDistanceCurrentLength; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getMotorAngularVelocityX() const =0
getMotorAngularVelocityX; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getConstraintForceX() const =0
getConstraintForceX; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setWeldAngularSpring(float hertz, float dampingRatio)=0
setWeldAngularSpring; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getConstraintTorqueY() const =0
getConstraintTorqueY; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setDistanceLimits(bool enabled, float minimum, float maximum)=0
setDistanceLimits; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setMotorLinearSpring(float hertz, float dampingRatio, float maxForce)=0
setMotorLinearSpring; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getSphericalTwistAngle() const =0
getSphericalTwistAngle; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getRevoluteMotorTorque() const =0
getRevoluteMotorTorque; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setWheelSteering(bool enabled, float targetAngle, float hertz, float dampingRatio, float maxTorque)=0
setWheelSteering; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getTorqueThreshold() const =0
getTorqueThreshold; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setMotorLinearVelocity(float vx, float vy, float vz)=0
setMotorLinearVelocity; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setWheelSuspension(bool enabled, float hertz, float dampingRatio)=0
setWheelSuspension; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getWeldLinearDampingRatio() const =0
getWeldLinearDampingRatio; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setForceThreshold(float threshold)=0
setForceThreshold; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setDistanceLength(float length)=0
setDistanceLength; see the class lifetime, validation and failure contract.
virtual void destroy() noexcept=0
Idempotently destroys the constraint; no failure or callbacks.
virtual ~IJointBackend3D()=default
virtual eve::Result< void > setRevoluteSpring(bool enabled, float targetAngle, float hertz, float dampingRatio)=0
setRevoluteSpring; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setSphericalTwistLimits(bool enabled, float lower, float upper)=0
setSphericalTwistLimits; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getWeldLinearHertz() const =0
getWeldLinearHertz; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getMotorLinearVelocityX() const =0
getMotorLinearVelocityX; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getMotorAngularVelocityY() const =0
getMotorAngularVelocityY; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getParallelDampingRatio() const =0
getParallelDampingRatio; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setRevoluteLimits(bool enabled, float lower, float upper)=0
setRevoluteLimits; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getPrismaticTranslation() const =0
getPrismaticTranslation; see the class lifetime, validation and failure contract.
virtual void bindOwner(Joint3D &owner) noexcept=0
Binds its exclusive facade owner for internal attribution, on the simulation thread....
virtual eve::Result< void > setParallelSpring(float hertz, float dampingRatio, float maxTorque)=0
setParallelSpring; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setDistanceMotor(bool enabled, float speed, float maxForce)=0
setDistanceMotor; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getMotorLinearVelocityZ() const =0
getMotorLinearVelocityZ; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setWeldLinearSpring(float hertz, float dampingRatio)=0
setWeldLinearSpring; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getConstraintForceZ() const =0
getConstraintForceZ; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getPrismaticSpeed() const =0
getPrismaticSpeed; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setDistanceSpring(bool enabled, float hertz, float dampingRatio)=0
setDistanceSpring; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setMotorVelocityLimits(float maxForce, float maxTorque)=0
setMotorVelocityLimits; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setWheelSpinMotor(bool enabled, float speed, float maxTorque)=0
setWheelSpinMotor; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getConstraintForceY() const =0
getConstraintForceY; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getDistanceLength() const =0
getDistanceLength; see the class lifetime, validation and failure contract.
virtual bool isValid() const noexcept=0
Whether the native constraint is still alive.
virtual eve::Result< float > getMotorAngularVelocityZ() const =0
getMotorAngularVelocityZ; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setSphericalConeLimit(bool enabled, float angle)=0
setSphericalConeLimit; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setTorqueThreshold(float threshold)=0
setTorqueThreshold; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getConstraintTorqueZ() const =0
getConstraintTorqueZ; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getWheelSteeringAngle() const =0
getWheelSteeringAngle; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setPrismaticLimits(bool enabled, float lower, float upper)=0
setPrismaticLimits; see the class lifetime, validation and failure contract.
virtual eve::Result< void > setMotorAngularVelocity(float wx, float wy, float wz)=0
setMotorAngularVelocity; see the class lifetime, validation and failure contract.
virtual eve::Result< float > getParallelMaxTorque() const =0
getParallelMaxTorque; see the class lifetime, validation and failure contract.
Script-facing joint owned by a World3D. Legacy scalar/void methods adapt the checked backend contract...
Definition Joint3D.h:27
Optional physics backend for vehicle mobility and body attach.
Definition Climbing.h:36
JointKind3D
Stable constraint kinds; numeric values are used by stress events.
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
bool enabled
Owning joint frames: local XYZ position followed by quaternion XYZW for each body.
std::array< float, 7 > bodyA
std::array< float, 7 > bodyB