载入中...
搜索中...
未找到
Box3DWorldJoints.cpp
浏览该文件的文档.
32eve::Result<std::unique_ptr<IJointBackend3D>> WorldBackend::newWeldJoint(Body3D& bodyARef, Body3D& bodyBRef,
58 return eve::Result<std::unique_ptr<IJointBackend3D>>::success(adoptJoint(id, JointKind3D::Weld));
62eve::Result<std::unique_ptr<IJointBackend3D>> WorldBackend::newMotorJoint(Body3D& bodyARef, Body3D& bodyBRef,
78 return eve::Result<std::unique_ptr<IJointBackend3D>>::success(adoptJoint(id, JointKind3D::Motor));
82eve::Result<std::unique_ptr<IJointBackend3D>> WorldBackend::newParallelJoint(Body3D& bodyARef, Body3D& bodyBRef,
106 return eve::Result<std::unique_ptr<IJointBackend3D>>::success(adoptJoint(id, JointKind3D::Parallel));
110eve::Result<std::unique_ptr<IJointBackend3D>> WorldBackend::newFilterJoint(Body3D& bodyARef, Body3D& bodyBRef) {
124 return eve::Result<std::unique_ptr<IJointBackend3D>>::success(adoptJoint(id, JointKind3D::Filter));
128eve::Result<std::unique_ptr<IJointBackend3D>> WorldBackend::newDistanceJoint(Body3D& bodyARef, Body3D& bodyBRef,
137 if (!isValid() || !bodyA || !bodyB || !bodyA->isValid() || !bodyB->isValid() || bodyA->getWorld() != owner_ ||
139 throw eve::Exception("World3D.newDistanceJoint: bodies must be distinct and belong to this world");
142 if (!std::isfinite(value)) throw eve::Exception("World3D.newDistanceJoint: parameters must be finite");
159 return eve::Result<std::unique_ptr<IJointBackend3D>>::success(adoptJoint(id, JointKind3D::Distance));
163eve::Result<std::unique_ptr<IJointBackend3D>> WorldBackend::newRevoluteJoint(Body3D& bodyARef, Body3D& bodyBRef,
171 if (!isValid() || !bodyA || !bodyB || !bodyA->isValid() || !bodyB->isValid() || bodyA->getWorld() != owner_ ||
173 throw eve::Exception("World3D.newRevoluteJoint: bodies must be distinct and belong to this world");
176 if (!std::isfinite(value)) throw eve::Exception("World3D.newRevoluteJoint: parameters must be finite");
179 if (axisLength <= 1e-8f) throw eve::Exception("World3D.newRevoluteJoint: axis length must be > 0");
197 return eve::Result<std::unique_ptr<IJointBackend3D>>::success(adoptJoint(id, JointKind3D::Revolute));
201eve::Result<std::unique_ptr<IJointBackend3D>> WorldBackend::newPrismaticJoint(Body3D& bodyARef, Body3D& bodyBRef,
209 if (!isValid() || !bodyA || !bodyB || !bodyA->isValid() || !bodyB->isValid() || bodyA->getWorld() != owner_ ||
211 throw eve::Exception("World3D.newPrismaticJoint: bodies must be distinct and belong to this world");
214 if (!std::isfinite(value)) throw eve::Exception("World3D.newPrismaticJoint: parameters must be finite");
217 if (axisLength <= 1e-8f) throw eve::Exception("World3D.newPrismaticJoint: axis length must be > 0");
235 return eve::Result<std::unique_ptr<IJointBackend3D>>::success(adoptJoint(id, JointKind3D::Prismatic));
239eve::Result<std::unique_ptr<IJointBackend3D>> WorldBackend::newSphericalJoint(Body3D& bodyARef, Body3D& bodyBRef,
247 if (!isValid() || !bodyA || !bodyB || !bodyA->isValid() || !bodyB->isValid() || bodyA->getWorld() != owner_ ||
249 throw eve::Exception("World3D.newSphericalJoint: bodies must be distinct and belong to this world");
252 if (!std::isfinite(value)) throw eve::Exception("World3D.newSphericalJoint: parameters must be finite");
255 if (axisLength <= 1e-8f) throw eve::Exception("World3D.newSphericalJoint: axis length must be > 0");
273 return eve::Result<std::unique_ptr<IJointBackend3D>>::success(adoptJoint(id, JointKind3D::Spherical));
277eve::Result<std::unique_ptr<IJointBackend3D>> WorldBackend::newWheelJoint(Body3D& bodyARef, Body3D& bodyBRef,
287 if (!isValid() || !bodyA || !bodyB || !bodyA->isValid() || !bodyB->isValid() || bodyA->getWorld() != owner_ ||
289 throw eve::Exception("World3D.newWheelJoint: bodies must be distinct and belong to this world");
293 if (!std::isfinite(value)) throw eve::Exception("World3D.newWheelJoint: parameters must be finite");
295 const float suspensionLength = std::sqrt(suspensionAxisX * suspensionAxisX + suspensionAxisY * suspensionAxisY +
301 const b3Vec3 suspensionAxis{suspensionAxisX / suspensionLength, suspensionAxisY / suspensionLength,
303 const b3Vec3 wheelAxis{wheelAxisX / wheelLength, wheelAxisY / wheelLength, wheelAxisZ / wheelLength};
322 return eve::Result<std::unique_ptr<IJointBackend3D>>::success(adoptJoint(id, JointKind3D::Wheel));
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
Backend-neutral 3D rigid body in meter-space coordinates (+Y up by convention). Owned by a World3D; c...
Definition Body3D.h:31
eve::Result< std::unique_ptr< IJointBackend3D > > newWeldJoint(Body3D &bodyA, Body3D &bodyB, float anchorX, float anchorY, float anchorZ, bool collideConnected) override
Creates an owning Weld constraint; bodies are synchronous non-owning inputs. @cost One native constra...
Definition Box3DWorldJoints.cpp:32
eve::Result< std::unique_ptr< IJointBackend3D > > newSphericalJoint(Body3D &bodyA, Body3D &bodyB, float anchorX, float anchorY, float anchorZ, float axisX, float axisY, float axisZ, bool collideConnected) override
Creates an owning Spherical constraint; bodies are synchronous non-owning inputs. @cost One native co...
Definition Box3DWorldJoints.cpp:239
eve::Result< std::unique_ptr< IJointBackend3D > > newPrismaticJoint(Body3D &bodyA, Body3D &bodyB, float anchorX, float anchorY, float anchorZ, float axisX, float axisY, float axisZ, bool collideConnected) override
Creates an owning Prismatic constraint; bodies are synchronous non-owning inputs. @cost One native co...
Definition Box3DWorldJoints.cpp:201
eve::Result< std::unique_ptr< IJointBackend3D > > newDistanceJoint(Body3D &bodyA, Body3D &bodyB, float anchorAX, float anchorAY, float anchorAZ, float anchorBX, float anchorBY, float anchorBZ, float length, bool collideConnected) override
Creates an owning Distance constraint; bodies are synchronous non-owning inputs. @cost One native con...
Definition Box3DWorldJoints.cpp:128
eve::Result< std::unique_ptr< IJointBackend3D > > newFilterJoint(Body3D &bodyA, Body3D &bodyB) override
Creates an owning Filter constraint; bodies are synchronous non-owning inputs. @cost One native const...
Definition Box3DWorldJoints.cpp:110
eve::Result< std::unique_ptr< IJointBackend3D > > newParallelJoint(Body3D &bodyA, Body3D &bodyB, float axisX, float axisY, float axisZ, bool collideConnected) override
Creates an owning Parallel constraint; bodies are synchronous non-owning inputs. @cost One native con...
Definition Box3DWorldJoints.cpp:82
eve::Result< std::unique_ptr< IJointBackend3D > > newRevoluteJoint(Body3D &bodyA, Body3D &bodyB, float anchorX, float anchorY, float anchorZ, float axisX, float axisY, float axisZ, bool collideConnected) override
Creates an owning Revolute constraint; bodies are synchronous non-owning inputs. @cost One native con...
Definition Box3DWorldJoints.cpp:163
eve::Result< std::unique_ptr< IJointBackend3D > > newWheelJoint(Body3D &bodyA, Body3D &bodyB, float anchorX, float anchorY, float anchorZ, float suspensionAxisX, float suspensionAxisY, float suspensionAxisZ, float wheelAxisX, float wheelAxisY, float wheelAxisZ, bool collideConnected) override
Creates an owning Wheel constraint; bodies are synchronous non-owning inputs. @cost One native constr...
Definition Box3DWorldJoints.cpp:277
eve::Result< std::unique_ptr< IJointBackend3D > > newMotorJoint(Body3D &bodyA, Body3D &bodyB, bool collideConnected) override
Creates an owning Motor constraint; bodies are synchronous non-owning inputs. @cost One native constr...
Definition Box3DWorldJoints.cpp:62
Definition Body3D.h:17
std::unique_ptr< IJointBackend3D > adoptJoint(b3JointId id, JointKind3D kind)
Adopts a live Box3D constraint; internal native composition boundary, simulation thread only.
Definition Box3DJoint.cpp:631
@ Distance
@ Spherical
@ Revolute
@ Prismatic
@ Parallel
@ Failed
static b3BodyId bodyId(const Body3D &body)
Borrows the native identifier synchronously; facade must belong to a Box3D world.
Definition Box3DBody.cpp:649