载入中...
搜索中...
未找到
PhysicsLink.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
14#include "common/Result.h"
16
17namespace eve::physics {
18
19class Body;
20class Body3D;
21class Joint3D;
22class Shape3D;
23class World;
24class World3D;
25
35 PhysicsWorldHandle world = PhysicsWorldHandle::invalid();
37 PhysicsBodyHandle body = PhysicsBodyHandle::invalid();
38
40 [[nodiscard]] bool isValid() const noexcept { return world.isValid() && body.isValid(); }
41
46 [[nodiscard("check the link construction outcome")]]
48
50 [[nodiscard("check the link construction outcome")]]
51 static eve::Result<PhysicsLink> fromBody(const Body& body);
53 [[nodiscard("check the link construction outcome")]]
54 static eve::Result<PhysicsLink> fromBody(const Body3D& body);
55
57 [[nodiscard("check stale-link resolution")]]
58 eve::Result<Body*> resolve(World& world) const;
60 [[nodiscard("check stale-link resolution")]]
61 eve::Result<Body3D*> resolve(World3D& world) const;
62};
63
73
75 [[nodiscard]] bool isValid() const noexcept { return world.isValid() && shape.isValid(); }
77 [[nodiscard("check the shape-link construction outcome")]]
80 [[nodiscard("check the shape-link construction outcome")]]
83 [[nodiscard("check stale shape-link resolution")]]
85};
86
96
98 [[nodiscard]] bool isValid() const noexcept { return world.isValid() && joint.isValid(); }
100 [[nodiscard("check the joint-link construction outcome")]]
103 [[nodiscard("check the joint-link construction outcome")]]
106 [[nodiscard("check stale joint-link resolution")]]
108};
109
110} // namespace eve::physics
#define EVENGINE_API_WORLD
Definition Export.h:109
World3D * world
Process-local, generation-qualified handles owned by the physics domain.
Move-only, checked operation results for the common layer.
std::string body
Move-only operation result carrying either a value or Status.
Definition Result.h:155
constexpr bool isValid() const noexcept
Returns whether both coordinates are usable handle values.
static constexpr RuntimeHandle invalid() noexcept
Returns the canonical invalid handle.
3D rigid body (Box3D) in meter-space coordinates (+Y up by convention). Owned by a World3D; create pr...
Definition Body3D.h:24
2D rigid body (Box2D) in pixel-space coordinates. Owned by a World; create shapes with newRectangleFi...
Definition Body.h:21
Script-facing Box3D joint owned by a World3D.
Definition Joint3D.h:17
3D shape (box/sphere/capsule) attached to a Body3D with material settings. Created via Body3D::new*Sh...
Definition Shape3D.h:25
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:63
Box2D world wrapper (2D physics) with pixel-space coordinates. Handles stepping, gravity,...
Definition World.h:41
Optional physics backend for vehicle mobility and body attach.
Definition Climbing.h:36