载入中...
搜索中...
未找到
JoltBody.cpp
浏览该文件的文档.
29eve::Result<std::unique_ptr<IShapeBackend3D>> BodyBackend::createShape(const ShapeGeometry3D& geometry, float density,
31 if (!isValid()) return rejected<std::unique_ptr<IShapeBackend3D>>("Body expired", eve::DiagnosticCode::StaleHandle);
32 if (!isFinite(density, friction, restitution) || density < 0 || friction < 0 || restitution < 0 || restitution > 1)
33 return rejected<std::unique_ptr<IShapeBackend3D>>("Invalid material", eve::DiagnosticCode::InvalidArgument);
49 return eve::Result<std::unique_ptr<IShapeBackend3D>>::success(std::make_unique<ShapeBackend>(shape));
Backend-neutral 3D rigid body in meter-space coordinates (+Y up by convention). Owned by a World3D; c...
Definition Body3D.h:31
void destroy() noexcept override
Releases the native body idempotently without callbacks; children must be detached first.
Definition JoltBody.cpp:15
eve::Result< std::unique_ptr< IShapeBackend3D > > createShape(const ShapeGeometry3D &geometry, float density, float friction, float restitution) override
Creates and owns one shape for this body; no input references are retained. @cost One geometry cook p...
Definition JoltBody.cpp:29
void invalidate() noexcept override
Detaches before its parent world destroys the native body.
Definition JoltBody.cpp:11
void bindOwner(Body3D &owner) noexcept override
Binds its exclusive facade owner for internal attribution, on the simulation thread....
Definition JoltBody.cpp:10
bool isValid() const noexcept override
Whether the native body remains alive.
Definition JoltBody.cpp:9
Definition JoltBody.cpp:7
eve::Result< T > rejected(const char *operation, eve::DiagnosticCode code=eve::DiagnosticCode::Unsupported)
Definition JoltInternal.h:21
eve::Result< void > replaceShapes(BodyState &, const std::vector< std::shared_ptr< ShapeState > > &)
Definition JoltShape.cpp:77
eve::Result< JPH::RefConst< JPH::Shape > > cook(const ShapeGeometry3D &, float density, JPH::uint64 userData)
Definition JoltShape.cpp:16
@ TriangleMesh
@ InvalidArgument
@ StaleHandle
Owning, backend-independent shape source; metres, local quaternion XYZW.
Definition ShapeBackend3D.h:13