载入中...
搜索中...
未找到
World3DQueries.cpp
浏览该文件的文档.
12bool World3D::sphereCast(float x1, float y1, float z1, float x2, float y2, float z2, float radius, uint64_t maskBits,
15 *out = worldValue(rigidBackend_->sphereCast(x1, y1, z1, x2, y2, z2, radius, maskBits, ignoredBodyId));
25int World3D::rayCastFiltered(float x1, float y1, float z1, float x2, float y2, float z2, uint64_t maskBits) {
30eve::Result<RayHit3D> World3D::rayCastOwned(float x1, float y1, float z1, float x2, float y2, float z2,
36int World3D::rayCastAll(float x1, float y1, float z1, float x2, float y2, float z2, int maxHits) {
46eve::Result<BroadPhaseAabb3D> World3D::queryAabbBroadPhaseOwned(float minX, float minY, float minZ, float maxX,
57int World3D::queryCapsule(float ax, float ay, float az, float bx, float by, float bz, float radius) {
62eve::Result<CapsuleOverlap3D> World3D::queryCapsuleOwned(float ax, float ay, float az, float bx, float by, float bz,
84int World3D::castCapsule(float ax, float ay, float az, float bx, float by, float bz, float radius, float dx, float dy,
90int World3D::castCapsuleAll(float ax, float ay, float az, float bx, float by, float bz, float radius, float dx,
92 return worldValue(rigidBackend_->castCapsuleAll(ax, ay, az, bx, by, bz, radius, dx, dy, dz, maxHits));
102int World3D::castBoxAll(float x, float y, float z, float width, float height, float depth, float qx, float qy, float qz,
116eve::Result<std::vector<eve::WorldSphereContact>> World3D::sweepSphereOwned(double x, double y, double z, double endX,
126 if (!isValid() || !std::isfinite(settings.radius) || settings.radius <= 0 || settings.ignoredBodyId < -1)
132 auto cast = rigidBackend_->castSphereAll(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z),
138 eve::Diagnostic::error(eve::DiagnosticCode::Conflict, "Sphere sweep contact budget exceeded", "contacts"));
166eve::Result<void> World3D::applySweepContactImpulse(const eve::WorldSphereContact& contact, PhysicsVector3D impulse,
168 if (!isValid() || contact.identity.world != runtimeHandle().packed() || contact.worldEpoch == 0 ||
171 eve::DiagnosticCode::NotFound, "Sweep contact world was destroyed, replaced or restored", "contact.world"));
175 eve::DiagnosticCode::NotFound, "Sweep contact body was destroyed or replaced", "contact.body"));
179 eve::DiagnosticCode::InvalidArgument, "Impulse and application point must be finite", "impulse"));
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static constexpr RuntimeHandle fromPacked(std::uint64_t value) noexcept
Reconstructs a handle from an explicit packed boundary value.
Definition RuntimeHandle.h:190
constexpr std::uint64_t packed() const noexcept
Encodes the two coordinates for a legacy integer boundary.
Definition RuntimeHandle.h:183
eve::Result< RayHit3D > rayCastOwned(float x1, float y1, float z1, float x2, float y2, float z2, QueryFilter3D filter={})
Performs one ray query and returns an owning, generation-qualified snapshot.
Definition World3DQueries.cpp:30
int castSphere(float x, float y, float z, float radius, float dx, float dy, float dz)
Sweep a sphere through the world and return the earliest hit body id, or -1.
Definition World3DQueries.cpp:74
int getShapeCastResultShapeId(int index) const
Shape ID of a sorted Shape Cast result.
int queryCapsule(float ax, float ay, float az, float bx, float by, float bz, float radius)
Query shapes overlapping an arbitrarily oriented capsule. The endpoints are the centers of its hemisp...
Definition World3DQueries.cpp:57
int closestPoint(float x, float y, float z, float maxDistance)
Find the closest collision surface within maxDistance of a world point. Uses the current query catego...
Definition World3DQueries.cpp:108
float getShapeCastResultFraction(int index) const
Translation fraction in [0,1] of a Shape Cast result.
PhysicsWorldHandle runtimeHandle() const noexcept
Process-local identity used by PhysicsLink; invalid after destruction.
Definition World3D.h:136
eve::Result< BroadPhaseAabb3D > queryAabbBroadPhaseOwned(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, QueryFilter3D filter={})
Queries one AABB into a fixed owning result without using the legacy query cache.
Definition World3DQueries.cpp:46
int castBox(float x, float y, float z, float width, float height, float depth, float qx, float qy, float qz, float qw, float dx, float dy, float dz)
Sweep an oriented box without changing its rotation.
Definition World3DQueries.cpp:96
eve::Result< std::vector< eve::WorldSphereContact > > sweepSphereOwned(double x, double y, double z, double endX, double endY, double endZ, eve::WorldSphereSweepSettings settings)
Owning, filtered sphere sweep for optional runtime consumers. @thread Owner thread; no callbacks....
Definition World3DQueries.cpp:116
Body3D * findBody(PhysicsBodyHandle handle) const
Borrows a live body; null for stale/foreign handles. Never delete lookup results.
Definition World3D.cpp:431
int castCapsule(float ax, float ay, float az, float bx, float by, float bz, float radius, float dx, float dy, float dz)
Sweep an arbitrarily oriented capsule through the world. The endpoints are cap centers and d{x,...
Definition World3DQueries.cpp:84
int querySphere(float x, float y, float z, float radius)
Query shapes overlapping a sphere in world meters.
Definition World3DQueries.cpp:52
float getShapeCastResultNormalZ(int index) const
Contact normal Z of a Shape Cast result.
int castCapsuleAll(float ax, float ay, float az, float bx, float by, float bz, float radius, float dx, float dy, float dz, int maxHits)
Collects the nearest maxHits swept-capsule intersections.
Definition World3DQueries.cpp:90
int rayCast(float x1, float y1, float z1, float x2, float y2, float z2)
Closest raycast from (x1,y1,z1) to (x2,y2,z2) in meters. Returns hit body id, or -1....
Definition World3DQueries.cpp:20
int castBoxAll(float x, float y, float z, float width, float height, float depth, float qx, float qy, float qz, float qw, float dx, float dy, float dz, int maxHits)
Collects the nearest maxHits swept-oriented-box intersections.
Definition World3DQueries.cpp:102
float getShapeCastResultNormalX(int index) const
Contact normal X of a Shape Cast result.
eve::Result< CapsuleOverlap3D > queryCapsuleOwned(float ax, float ay, float az, float bx, float by, float bz, float radius, QueryFilter3D filter={})
Performs one capsule overlap and returns an owning summary without exposing the query cache.
Definition World3DQueries.cpp:62
int queryBox(float x, float y, float z, float width, float height, float depth, float qx, float qy, float qz, float qw)
Query shapes overlapping an oriented box.
Definition World3DQueries.cpp:68
bool sphereCast(float x1, float y1, float z1, float x2, float y2, float z2, float radius, uint64_t maskBits, int ignoredBodyId, CameraSphereHit3D *out) const
Internal camera query: swept sphere against non-sensor shapes.
Definition World3DQueries.cpp:12
std::uint64_t queryEpoch() const noexcept
Monotonic query binding revision; successful restore invalidates prior sessions.
Definition World3D.h:645
eve::Result< void > applySweepContactImpulse(const eve::WorldSphereContact &contact, PhysicsVector3D impulse, PhysicsVector3D worldPoint)
Explicitly apply a world-space impulse (N s) to a sweep contact's dynamic body.
Definition World3DQueries.cpp:166
int queryAABB(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
Query shapes overlapping an AABB in meters (min/max corners). Returns match count; read ids with getQ...
Definition World3DQueries.cpp:41
int castSphereAll(float x, float y, float z, float radius, float dx, float dy, float dz, int maxHits)
Collects the nearest maxHits swept-sphere intersections.
Definition World3DQueries.cpp:79
Body3D * findBodyById(int bodyId) const
Borrows a live body by stable event/query id; never delete lookup results.
Definition World3D.cpp:439
float getShapeCastResultNormalY(int index) const
Contact normal Y of a Shape Cast result.
int rayCastAll(float x1, float y1, float z1, float x2, float y2, float z2, int maxHits)
Collects the nearest maxHits ray intersections, sorted by fraction then Shape ID.
Definition World3DQueries.cpp:36
int rayCastFiltered(float x1, float y1, float z1, float x2, float y2, float z2, uint64_t maskBits)
带形状类别掩码的最短射线查询(掩码为接受的 shape categoryBits)。
Definition World3DQueries.cpp:25
int getShapeCastResultBodyId(int index) const
Body ID of a sorted Shape Cast result.
T worldValue(eve::Result< T > result)
Definition World3DInternal.h:45
@ InvalidArgument
@ NotFound
@ Unsupported
@ Conflict
Owning sphere sweep contact; position is the moving sphere center, not the obstacle surface.
Definition WorldSphereSweep.h:18
Immutable per-binding sphere and filter policy.
Definition WorldSphereSweep.h:29
Allocation-free owning three-dimensional physics value.
Definition RigidTypes3D.h:4
Query filter applied atomically for one owning query operation.
Definition OwnedQuery3D.h:47