载入中...
搜索中...
未找到
Climbing.cpp
浏览该文件的文档.
1#include "climbing/Climbing.h"
2
6
8#include "common/Assert.h"
9#include "physics/Body3D.h"
10#include "physics/World3D.h"
11
12#include <algorithm>
13#include <charconv>
14#include <chrono>
15#include <cmath>
16#include <limits>
17#include <tuple>
18#include <utility>
19
20namespace eve::climbing {
21using namespace runtime_detail;
22
23namespace {
24void swapCandidates(ClimbingCandidate& a, ClimbingCandidate& b) noexcept {
25 const auto fields = [](ClimbingCandidate& c) {
26 return std::tie(c.actionId, c.definitionGeneration, c.world, c.obstacleBody, c.obstacleShape, c.obstacleBodyId,
27 c.obstacleShapeId, c.ignoredBodyId, c.frontPoint, c.topPoint, c.landingFeet, c.surfaceNormal,
28 c.surfaceTangent, c.leftHandAnchor, c.rightHandAnchor, c.bodyLocalTop, c.bodyLocalLanding,
29 c.obstacleHeight, c.obstacleDepth, c.gapDistance, c.clearanceHeight, c.slopeRadians,
30 c.curvature, c.supportShapeTag, c.supportMaterialId, c.probeRecipe, c.score, c.kind, c.support);
31 };
32 auto left = fields(a);
33 auto right = fields(b);
34 // Member swaps retain MSVC's debug string proxies as well as character storage.
35 left.swap(right);
36}
37} // namespace
38
39
41 std::string actionId;
42 actionId.swap(candidate.actionId);
43 considerWithActionId(std::move(candidate), actionId);
44}
45
46void ClimbingCandidateSet::considerWithActionId(const ClimbingCandidate& candidate, std::string_view actionId) {
47 const auto store = [&](ClimbingCandidate& slot) {
48 slot = candidate;
49 slot.actionId.assign(actionId);
50 };
51 if (size_ < Capacity) {
52 store(values_[size_++]);
53 return;
54 }
55 auto worst = std::max_element(values_.begin(), values_.end(), isCandidateLess);
56 const bool better = candidate.score != worst->score
57 ? candidate.score < worst->score
58 : actionId != worst->actionId
59 ? actionId < std::string_view(worst->actionId)
60 : candidate.obstacleBodyId != worst->obstacleBodyId
61 ? candidate.obstacleBodyId < worst->obstacleBodyId
62 : candidate.obstacleShapeId < worst->obstacleShapeId;
63 if (better) store(*worst);
64}
65
67 for (std::size_t i = 1; i < size_; ++i)
68 for (std::size_t j = i; j > 0 && isCandidateLess(values_[j], values_[j - 1]); --j)
69 swapCandidates(values_[j], values_[j - 1]);
70 size_ = std::min(size_, std::min(limit, Capacity));
71}
72
74 for (std::size_t i = 0; i < Capacity; ++i) swapCandidates(values_[i], other.values_[i]);
75 std::swap(size_, other.size_);
76}
77
78eve::Result<void> ClimbingRuntime::requireEventCapacity(std::size_t count, eve::SimulationTick tick) const {
79 if (count > PendingEventCapacity - pendingEvents_.size())
81 eve::DiagnosticCode::Conflict, "climbing event queue must be drained before simulation can continue",
82 "runtime.pendingEvents", {}, "climbing"));
83 if (!pendingEvents_.empty() && tick < pendingEvents_.back().tick)
85 eve::DiagnosticCode::Conflict, "climbing event tick must not precede an undelivered event",
86 "runtime.pendingEvents.tick", {}, "climbing"));
88}
89
90void ClimbingRuntime::enqueueEvent(ClimbingEvent event) {
91 EV_ASSERT(pendingEvents_.size() < PendingEventCapacity, "climbing event queue capacity invariant");
92 const bool ordered = pendingEvents_.empty() || pendingEvents_.back().tick <= event.tick;
93 EV_ASSERT(ordered, "climbing event production order must be monotonic by tick");
94 if (event.metadata.empty() && execution_ && execution_->action.id == event.actionId)
95 event.metadata = execution_->action.eventMetadata;
96 pendingEvents_.push_back(std::move(event));
97}
98
105
107 return publishProfile(std::move(profile), false);
108}
109
111 return {profile_.groundAcceleration, profile_.groundBraking, profile_.airControl,
112 profile_.gravity, profile_.jumpSpeed, profile_.coyoteTicks, profile_.queryFilter};
113}
114
115eve::Result<void> ClimbingRuntime::publishProfile(ClimbingProfile profile, bool allowActiveExecution) {
117 if (!valid) return eve::Result<void>::failure(valid.status());
118 if (!allowActiveExecution && isActivePhase(phase_))
120 "profile cannot change while an execution is active",
121 "runtime.phase", {}, "climbing"));
122 if (definitionGeneration_ == std::numeric_limits<std::uint64_t>::max())
124 "climbing definition generation is exhausted",
125 "runtime.definitionGeneration", {}, "climbing"));
126 std::sort(profile.actions.begin(), profile.actions.end(),
127 [](const auto& lhs, const auto& rhs) { return lhs.id < rhs.id; });
128 const auto duplicate = std::adjacent_find(profile.actions.begin(), profile.actions.end(),
129 [](const auto& lhs, const auto& rhs) { return lhs.id == rhs.id; });
130 if (duplicate != profile.actions.end())
132 eve::DiagnosticCode::Conflict, "profile contains duplicate action ids", "profile.actions", {}, "climbing"));
133 profile_ = std::move(profile);
134 validatedAnimationActions_.clear();
135 ++definitionGeneration_;
137}
138
141 if (!valid) return eve::Result<void>::failure(valid.status());
142 if (definitionGeneration_ == std::numeric_limits<std::uint64_t>::max())
144 "climbing definition generation is exhausted",
145 "runtime.definitionGeneration", {}, "climbing"));
146 const std::string actionId = action.id;
147 auto found = std::lower_bound(profile_.actions.begin(), profile_.actions.end(), action.id,
148 [](const auto& entry, const std::string& id) { return entry.id < id; });
149 if (found != profile_.actions.end() && found->id == action.id)
150 *found = std::move(action);
151 else
152 profile_.actions.insert(found, std::move(action));
153 validatedAnimationActions_.erase(actionId);
154 ++definitionGeneration_;
156}
157
159 const animation::AnimClip& clip) {
160 const ClimbingActionDefinition* action = findAction(profile_, actionId);
161 if (!action)
163 "animation binding references an unknown action",
164 "actionId", {}, "climbing"));
165 if (!action->animation.clipId.empty() && clip.getName() != action->animation.clipId)
167 "animation clip does not match the action binding",
168 "action.animation.clipId", {}, "climbing"));
169 auto validated = clip.validateNotifyContract(action->requiredNotifies);
170 if (!validated)
173 "climbing.animation.notify_missing: " + validated.status().describe(),
174 "action.requiredNotifies", {}, "climbing"));
175 validatedAnimationActions_.insert(action->id);
177}
178
186
190 lastCandidates_.clear();
191 lastQueryCount_ = 0;
192 lastCounters_ = {};
195 RuntimeTelemetryScope telemetryScope(telemetry_, lastCounters_, tick);
196 if (debugCapture_ == ClimbingDebugCapture::Enabled) {
197 lastDebugQueries_.clear();
198 lastEvidence_.clear();
199 }
200 // Definitions are immutable between generations. Validate a changed profile
201 // once, rather than allocating action/tag validation sets on every probe.
202 if (validatedProfileGeneration_ != definitionGeneration_) {
204 if (!valid) return eve::Result<void>::failure(valid.status());
205 validatedProfileGeneration_ = definitionGeneration_;
206 }
207 if (!world.isValid())
209 eve::DiagnosticCode::StaleHandle, "physics world is no longer valid", "world", {}, "climbing"));
210 if (!isFinite(pose.feet) || !isFinite(pose.forward) || !isFinite(pose.speed) || pose.speed < 0.f ||
211 !isFinite(pose.verticalSpeed) || !isFinite(pose.moveIntent) || !isFinite(pose.lookIntent))
213 "pose values must be finite and speed non-negative",
214 "pose", {}, "climbing"));
215 const Vec3 forward = normalizedHorizontal(pose.forward);
218 "pose forward must have a horizontal direction",
219 "pose.forward", {}, "climbing"));
220
221 ClimbingCandidateSet& candidates = probeScratch_;
223 const auto reserveQuery = [&]() noexcept {
224 if (lastQueryCount_ >= lastCounters_.queryBudget) {
226 return false;
227 }
228 ++lastQueryCount_;
229 lastCounters_.queryCount = lastQueryCount_;
230 return true;
231 };
232 const auto rejectCandidate = [&]() noexcept { ++lastCounters_.rejectCount; };
233 const auto finalizeCandidates = [&]() -> eve::Result<void> {
234 candidates.sortAndLimit(profile_.maxCandidates);
235 if (!candidates.empty()) lastCounters_.selectedCost = candidates.front().score;
236 if (debugCapture_ == ClimbingDebugCapture::Enabled)
237 lastCandidates_.assign(candidates.begin(), candidates.end());
238 candidates.swap(output);
240 };
241
242 const auto captureBodyLocal = [&](ClimbingCandidate& candidate) -> eve::Result<void> {
243 if (physics::Body3D* body = world.findBody(candidate.obstacleBody)) {
244 auto localTop = body->worldToLocalPointOwned(candidate.topPoint.x, candidate.topPoint.y,
245 candidate.topPoint.z);
246 if (!localTop) return eve::Result<void>::failure(localTop.status());
247 auto localLanding = body->worldToLocalPointOwned(candidate.landingFeet.x, candidate.landingFeet.y,
248 candidate.landingFeet.z);
249 if (!localLanding) return eve::Result<void>::failure(localLanding.status());
250 candidate.bodyLocalTop = {localTop.value().x, localTop.value().y, localTop.value().z};
251 candidate.bodyLocalLanding = {localLanding.value().x, localLanding.value().y,
252 localLanding.value().z};
253 }
255 };
256
258 filter.ignoredBodyId = pose.ignoredBodyId;
259 const float broadRadius = profile_.maxProbeDistance + profile_.capsuleRadius + profile_.skin;
260 auto broadPhase = world.queryAabbBroadPhaseOwned(
261 pose.feet.x - broadRadius, pose.feet.y - profile_.skin, pose.feet.z - broadRadius,
262 pose.feet.x + broadRadius, pose.feet.y + profile_.maxObstacleHeight + profile_.capsuleHeight,
263 pose.feet.z + broadRadius, filter);
264 if (!broadPhase) return eve::Result<void>::failure(broadPhase.status());
265 lastCounters_.broadPhaseQueryCount = 1;
266 lastCounters_.broadPhaseHitCount = static_cast<std::uint32_t>(broadPhase.value().count);
267 if (broadPhase.value().count == 0) return finalizeCandidates();
268 const auto broadPhaseContains = [&](physics::PhysicsShapeHandle shape) noexcept {
269 if (broadPhase.value().truncated) return true;
270 return std::any_of(broadPhase.value().hits.begin(),
271 broadPhase.value().hits.begin() +
272 static_cast<std::ptrdiff_t>(broadPhase.value().count),
273 [&](const physics::BroadPhaseHit3D& hit) { return hit.shape == shape; });
274 };
275
276 const bool hasSlide = std::any_of(profile_.actions.begin(), profile_.actions.end(), [&](const auto& action) {
277 return action.kind == ClimbingActionKind::Slide && isActionEnabledForPose(profile_, action, pose) &&
278 isProbeRecipeMatchingKind(action);
279 });
280 if (hasSlide && pose.grounded) {
281 const Vec3 groundStart{pose.feet.x, pose.feet.y + 0.25f, pose.feet.z};
282 const Vec3 groundEnd{pose.feet.x, pose.feet.y - 0.35f, pose.feet.z};
283 if (!reserveQuery()) return finalizeCandidates();
284 auto groundResult = world.rayCastOwned(groundStart.x, groundStart.y, groundStart.z,
285 groundEnd.x, groundEnd.y, groundEnd.z, filter);
286 if (!groundResult) return eve::Result<void>::failure(groundResult.status());
287 const physics::RayHit3D ground = std::move(groundResult).takeValue();
288 if (debugCapture_ == ClimbingDebugCapture::Enabled)
289 boundedDebugPush(lastDebugQueries_, ClimbingDebugQuery{"", ground.hit ? "slide.ground" : "slide.no_ground",
290 groundStart, groundEnd});
291 if (ground.hit && broadPhaseContains(ground.shape) && ground.normalY >= profile_.minTopNormalY) {
292 for (const auto& action : profile_.actions) {
295 continue;
296 if (pose.speed + epsilon < action.minSpeed) {
297 rejectCandidate();
298 if (debugCapture_ == ClimbingDebugCapture::Enabled)
299 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "below_min_speed"});
300 continue;
301 }
302 if (!isSupportSelectorMatch(action, ground.shapeTag, ground.materialId)) {
303 rejectCandidate();
304 if (debugCapture_ == ClimbingDebugCapture::Enabled)
305 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "support_tag_rejected"});
306 continue;
307 }
308 const Vec3 landing = pose.feet + forward * action.landingForward;
309 const float lowerY = landing.y + profile_.capsuleRadius + profile_.skin;
310 const float upperY = landing.y + profile_.compactCapsuleHeight - profile_.capsuleRadius + profile_.skin;
311 if (!reserveQuery()) return finalizeCandidates();
312 auto overlap = world.queryCapsuleOwned(landing.x, lowerY, landing.z, landing.x, upperY, landing.z,
313 profile_.capsuleRadius, filter);
314 if (!overlap) return eve::Result<void>::failure(overlap.status());
315 if (overlap.value().bodyCount != 0) {
316 rejectCandidate();
317 if (debugCapture_ == ClimbingDebugCapture::Enabled)
318 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "clearance_blocked"});
319 continue;
320 }
321 const static ClimbingCandidate emptyCandidate;
322 ClimbingCandidate& candidate = probeCandidate_;
323 candidate = emptyCandidate;
324 candidate.definitionGeneration = definitionGeneration_;
325 candidate.world = world.runtimeHandle();
326 candidate.obstacleBody = ground.body;
327 candidate.obstacleShape = ground.shape;
328 candidate.obstacleBodyId = ground.bodyId;
329 candidate.obstacleShapeId = ground.shapeId;
330 candidate.ignoredBodyId = pose.ignoredBodyId;
331 candidate.frontPoint = {ground.x, ground.y, ground.z};
332 candidate.topPoint = candidate.frontPoint;
333 candidate.landingFeet = landing;
334 candidate.surfaceNormal = {ground.normalX, ground.normalY, ground.normalZ};
335 candidate.surfaceTangent = forward;
336 candidate.gapDistance = action.landingForward;
337 candidate.clearanceHeight = profile_.compactCapsuleHeight;
338 candidate.slopeRadians = std::acos(std::clamp(ground.normalY, -1.f, 1.f));
339 candidate.supportShapeTag = ground.shapeTag;
340 candidate.supportMaterialId = ground.materialId;
341 candidate.probeRecipe = action.probeRecipe;
342 candidate.score = selectionCost(profile_, action, pose, forward, landing - pose.feet,
343 0.f, action.landingForward) +
344 (previousActionId_ == action.id ? action.repetitionPenalty : 0);
345 candidate.kind = action.kind;
346 auto captured = captureBodyLocal(candidate);
347 if (!captured) return eve::Result<void>::failure(captured.status());
348 if (debugCapture_ == ClimbingDebugCapture::Enabled)
350 action.id, "accepted", static_cast<std::int64_t>(action.selectionBias) * 1000000ll,
351 0, quantizeMillimeters(action.landingForward), candidate.score});
352 candidates.considerWithActionId(std::move(candidate), action.id);
353 }
354 }
355 }
356
357 const bool hasWallRun = std::any_of(profile_.actions.begin(), profile_.actions.end(), [&](const auto& action) {
358 return action.kind == ClimbingActionKind::WallRun && isActionEnabledForPose(profile_, action, pose) &&
359 isProbeRecipeMatchingKind(action);
360 });
361 if (hasWallRun) {
362 const Vec3 chest{pose.feet.x, pose.feet.y + profile_.capsuleHeight * 0.55f, pose.feet.z};
363 const Vec3 sides[2] = {{-forward.z, 0.f, forward.x}, {forward.z, 0.f, -forward.x}};
364 for (std::size_t sideIndex = 0; sideIndex < 2; ++sideIndex) {
365 const Vec3 end = chest + sides[sideIndex] * profile_.maxProbeDistance;
366 if (!reserveQuery()) return finalizeCandidates();
367 auto sideResult = world.rayCastOwned(chest.x, chest.y, chest.z, end.x, end.y, end.z, filter);
368 if (!sideResult) return eve::Result<void>::failure(sideResult.status());
369 const physics::RayHit3D hit = std::move(sideResult).takeValue();
370 if (debugCapture_ == ClimbingDebugCapture::Enabled)
371 boundedDebugPush(lastDebugQueries_, ClimbingDebugQuery{"", hit.hit ? "wall_run.wall" : "wall_run.miss",
372 chest, end});
373 Vec3 normal = hit.hit ? normalizedHorizontal({hit.normalX, hit.normalY, hit.normalZ}) : Vec3{};
374 if (!hit.hit || !broadPhaseContains(hit.shape) || lengthSquared(normal) <= epsilon ||
375 std::fabs(hit.normalY) > 0.35f)
376 continue;
377 Vec3 tangent{normal.z, 0.f, -normal.x};
378 if (tangent.x * forward.x + tangent.z * forward.z < 0.f) tangent = tangent * -1.f;
379 for (const auto& action : profile_.actions) {
381 !isProbeRecipeMatchingKind(action) || pose.speed + epsilon < action.minSpeed)
382 continue;
383 if (!isSupportSelectorMatch(action, hit.shapeTag, hit.materialId)) {
384 rejectCandidate();
385 continue;
386 }
387 const float wallOffset = profile_.capsuleRadius + profile_.skin;
388 const Vec3 landing{hit.x + normal.x * wallOffset + tangent.x * action.landingForward,
389 pose.feet.y, hit.z + normal.z * wallOffset + tangent.z * action.landingForward};
390 const float lowerY = landing.y + profile_.capsuleRadius + profile_.skin;
391 const float upperY = landing.y + profile_.capsuleHeight - profile_.capsuleRadius + profile_.skin;
392 if (!reserveQuery()) return finalizeCandidates();
393 auto overlap = world.queryCapsuleOwned(landing.x, lowerY, landing.z, landing.x, upperY, landing.z,
394 profile_.capsuleRadius, filter);
395 if (!overlap) return eve::Result<void>::failure(overlap.status());
396 if (overlap.value().bodyCount != 0) {
397 rejectCandidate();
398 continue;
399 }
400 const static ClimbingCandidate emptyCandidate;
401 ClimbingCandidate& candidate = probeCandidate_;
402 candidate = emptyCandidate;
403 candidate.definitionGeneration = definitionGeneration_;
404 candidate.world = world.runtimeHandle();
405 candidate.obstacleBody = hit.body;
406 candidate.obstacleShape = hit.shape;
407 candidate.obstacleBodyId = hit.bodyId;
408 candidate.obstacleShapeId = hit.shapeId;
409 candidate.ignoredBodyId = pose.ignoredBodyId;
410 candidate.frontPoint = {hit.x, hit.y, hit.z};
411 candidate.topPoint = candidate.frontPoint;
412 candidate.landingFeet = landing;
413 candidate.surfaceNormal = normal;
414 candidate.surfaceTangent = tangent;
415 const float distance = std::sqrt((hit.x - chest.x) * (hit.x - chest.x) +
416 (hit.z - chest.z) * (hit.z - chest.z));
417 candidate.gapDistance = distance;
418 candidate.clearanceHeight = profile_.capsuleHeight;
419 candidate.slopeRadians = std::acos(std::clamp(hit.normalY, -1.f, 1.f));
420 candidate.supportShapeTag = hit.shapeTag;
421 candidate.supportMaterialId = hit.materialId;
422 candidate.probeRecipe = action.probeRecipe;
423 candidate.score = selectionCost(profile_, action, pose, tangent, landing - pose.feet,
424 0.f, distance, static_cast<std::int64_t>(sideIndex)) +
425 (previousActionId_ == action.id ? action.repetitionPenalty : 0) +
426 0;
427 candidate.kind = action.kind;
428 auto captured = captureBodyLocal(candidate);
429 if (!captured) return eve::Result<void>::failure(captured.status());
430 if (debugCapture_ == ClimbingDebugCapture::Enabled)
432 action.id, "accepted", static_cast<std::int64_t>(action.selectionBias) * 1000000ll,
433 0, quantizeMillimeters(distance), candidate.score});
434 candidates.considerWithActionId(std::move(candidate), action.id);
435 }
436 }
437 }
438
439 const bool hasObstacleProbe =
440 std::any_of(profile_.actions.begin(), profile_.actions.end(), [&](const auto& action) {
441 return isObstacleProbeKind(action.kind) && isActionEnabledForPose(profile_, action, pose) &&
442 isProbeRecipeMatchingKind(action);
443 });
444 if (!hasObstacleProbe) return finalizeCandidates();
445 // A single chest-height ray skips low vault obstacles entirely. The obstacle recipe starts just above the
446 // capsule's lower hemisphere so it can see every valid obstacle above the profile's physical skin; top and
447 // landing queries still provide the authoritative height and clearance rejection.
448 const float obstacleProbeY = pose.feet.y + profile_.capsuleRadius + profile_.skin;
449 const Vec3 frontStart{pose.feet.x, obstacleProbeY, pose.feet.z};
450 const Vec3 frontEnd = frontStart + forward * profile_.maxProbeDistance;
451 if (!reserveQuery()) return finalizeCandidates();
452 auto frontResult =
453 world.rayCastOwned(frontStart.x, frontStart.y, frontStart.z, frontEnd.x, frontEnd.y, frontEnd.z, filter);
454 if (!frontResult) return eve::Result<void>::failure(frontResult.status());
455 const physics::RayHit3D front = std::move(frontResult).takeValue();
456 if (debugCapture_ == ClimbingDebugCapture::Enabled)
457 boundedDebugPush(lastDebugQueries_, ClimbingDebugQuery{"", front.hit ? "front.hit" : "front.miss",
458 frontStart, frontEnd});
459 if (!front.hit || !broadPhaseContains(front.shape)) return finalizeCandidates();
460
461 const Vec3 overFront{front.x + forward.x * (profile_.capsuleRadius + profile_.skin),
462 pose.feet.y + profile_.maxObstacleHeight + profile_.skin,
463 front.z + forward.z * (profile_.capsuleRadius + profile_.skin)};
464 const Vec3 topEnd{overFront.x, pose.feet.y + profile_.skin, overFront.z};
465 if (!reserveQuery()) return finalizeCandidates();
466 auto topResult = world.rayCastOwned(overFront.x, overFront.y, overFront.z, topEnd.x, topEnd.y, topEnd.z, filter);
467 if (!topResult) return eve::Result<void>::failure(topResult.status());
468 const physics::RayHit3D top = std::move(topResult).takeValue();
469 if (debugCapture_ == ClimbingDebugCapture::Enabled)
470 boundedDebugPush(lastDebugQueries_, ClimbingDebugQuery{"", top.hit ? "top.hit" : "top.miss", overFront,
471 topEnd});
472 if (!top.hit || top.body != front.body || top.normalY < profile_.minTopNormalY)
473 return finalizeCandidates();
474
475 const float height = top.y - pose.feet.y;
476 if (height < 0.f || height > profile_.maxObstacleHeight + profile_.skin)
477 return finalizeCandidates();
478
479 const float baseDepth = std::sqrt((top.x - front.x) * (top.x - front.x) +
480 (top.z - front.z) * (top.z - front.z));
481 float measuredDepth = baseDepth;
482 float measuredCurvature = 0.f;
483 const float topSlope = std::acos(std::clamp(top.normalY, -1.f, 1.f));
484 float depthProbeDistance = 0.f;
485 bool needsDepthEvidence = false;
486 for (const ClimbingActionDefinition& action : profile_.actions) {
487 if (!isObstacleProbeKind(action.kind) || !isActionEnabledForPose(profile_, action, pose) ||
489 continue;
490 if (action.minDepth > baseDepth + epsilon || action.maxDepth < 999.f || action.maxCurvature < 999.f) {
491 needsDepthEvidence = true;
492 depthProbeDistance = std::max(depthProbeDistance, std::max(action.minDepth, action.maxDepth < 999.f
493 ? action.maxDepth + profile_.skin
494 : 0.f));
495 }
496 }
497 depthProbeDistance = std::min(profile_.maxProbeDistance, std::max(0.f, depthProbeDistance - baseDepth));
498 if (needsDepthEvidence && depthProbeDistance > epsilon) {
499 const std::uint32_t sampleCount = std::min<std::uint32_t>(4, profile_.probeSectors);
500 Vec3 previousNormal{top.normalX, top.normalY, top.normalZ};
501 const float stepDistance = depthProbeDistance / static_cast<float>(sampleCount);
502 for (std::uint32_t sample = 1; sample <= sampleCount; ++sample) {
503 if (!reserveQuery()) break;
504 const float offset = stepDistance * static_cast<float>(sample);
505 const Vec3 sampleStart{top.x + forward.x * offset, top.y + profile_.skin + 0.2f,
506 top.z + forward.z * offset};
507 const Vec3 sampleEnd{sampleStart.x, top.y - profile_.skin - 0.2f, sampleStart.z};
508 auto sampled = world.rayCastOwned(sampleStart.x, sampleStart.y, sampleStart.z, sampleEnd.x,
509 sampleEnd.y, sampleEnd.z, filter);
510 if (!sampled) return eve::Result<void>::failure(sampled.status());
511 const physics::RayHit3D hit = std::move(sampled).takeValue();
512 if (!hit.hit || hit.body != top.body || hit.normalY < profile_.minTopNormalY) break;
513 measuredDepth = baseDepth + offset;
514 const Vec3 normal{hit.normalX, hit.normalY, hit.normalZ};
515 const float dot = std::clamp(previousNormal.x * normal.x + previousNormal.y * normal.y +
516 previousNormal.z * normal.z,
517 -1.f, 1.f);
518 measuredCurvature = std::max(measuredCurvature, std::acos(dot) / std::max(stepDistance, epsilon));
519 previousNormal = normal;
520 }
521 }
522
523 for (const ClimbingActionDefinition& action : profile_.actions) {
524 if (!isActionEnabledForPose(profile_, action, pose)) {
525 rejectCandidate();
526 if (debugCapture_ == ClimbingDebugCapture::Enabled)
527 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "definition_policy_rejected"});
528 continue;
529 }
531 rejectCandidate();
532 if (debugCapture_ == ClimbingDebugCapture::Enabled)
533 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "probe_recipe_rejected"});
534 continue;
535 }
536 if (!isObstacleProbeKind(action.kind)) {
537 if (isRuntimeProbeKind(action.kind)) continue;
538 rejectCandidate();
539 if (debugCapture_ == ClimbingDebugCapture::Enabled)
540 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "anchor_graph_only"});
541 continue;
542 }
543 if (height + epsilon < action.minHeight || height - epsilon > action.maxHeight) {
544 rejectCandidate();
545 if (debugCapture_ == ClimbingDebugCapture::Enabled)
546 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "out_of_height_range"});
547 continue;
548 }
549 if (measuredDepth + epsilon < action.minDepth || measuredDepth - epsilon > action.maxDepth ||
550 topSlope - epsilon > action.maxSlopeRadians || measuredCurvature - epsilon > action.maxCurvature ||
551 !isSupportSelectorMatch(action, top.shapeTag, top.materialId)) {
552 rejectCandidate();
553 if (debugCapture_ == ClimbingDebugCapture::Enabled)
554 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "support_geometry_rejected"});
555 continue;
556 }
557 if (pose.speed + epsilon < action.minSpeed) {
558 rejectCandidate();
559 if (debugCapture_ == ClimbingDebugCapture::Enabled)
560 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "below_min_speed"});
561 continue;
562 }
563 const bool wantsHang = action.kind == ClimbingActionKind::LedgeGrab;
564 if ((wantsHang && (pose.grounded || pose.verticalSpeed > epsilon)) || (!wantsHang && !pose.grounded)) {
565 rejectCandidate();
566 if (debugCapture_ == ClimbingDebugCapture::Enabled)
567 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "source_mode_rejected"});
568 continue;
569 }
570
571 const Vec3 landing =
572 wantsHang
573 ? Vec3{front.x - forward.x * (profile_.capsuleRadius + profile_.skin + action.hangBodyOffset),
574 top.y - action.hangFeetBelowLedge,
575 front.z - forward.z * (profile_.capsuleRadius + profile_.skin + action.hangBodyOffset)}
576 : Vec3{top.x + forward.x * action.landingForward, top.y, top.z + forward.z * action.landingForward};
577 const float lowerY = landing.y + profile_.capsuleRadius + profile_.skin;
578 const float upperY = landing.y + profile_.capsuleHeight - profile_.capsuleRadius + profile_.skin;
579 if (!reserveQuery()) return finalizeCandidates();
580 auto overlap = world.queryCapsuleOwned(landing.x, lowerY, landing.z, landing.x, upperY, landing.z,
581 profile_.capsuleRadius, filter);
582 if (!overlap) return eve::Result<void>::failure(overlap.status());
583 if (debugCapture_ == ClimbingDebugCapture::Enabled)
584 boundedDebugPush(lastDebugQueries_,
586 overlap.value().bodyCount == 0 ? "landing.clear" : "landing.blocked",
587 landing, landing, profile_.capsuleRadius, profile_.capsuleHeight});
588 if (overlap.value().bodyCount != 0) {
589 rejectCandidate();
590 if (debugCapture_ == ClimbingDebugCapture::Enabled)
591 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "clearance_blocked"});
592 continue;
593 }
594
596 if (wantsHang) {
597 const Vec3 supportStart{landing.x, landing.y + profile_.capsuleHeight * 0.45f, landing.z};
598 const Vec3 supportEnd =
599 supportStart + forward * (profile_.capsuleRadius + profile_.skin + action.hangBodyOffset + 0.25f);
600 if (!reserveQuery()) return finalizeCandidates();
601 auto supportHit = world.rayCastOwned(supportStart.x, supportStart.y, supportStart.z, supportEnd.x,
602 supportEnd.y, supportEnd.z, filter);
603 if (!supportHit) return eve::Result<void>::failure(supportHit.status());
604 if (debugCapture_ == ClimbingDebugCapture::Enabled)
605 boundedDebugPush(lastDebugQueries_,
607 supportHit.value().hit ? "support.hit" : "support.miss",
608 supportStart, supportEnd});
609 support = supportHit.value().hit && supportHit.value().body == front.body ? HangSupport::Braced
611 }
612
613 const float distance = std::sqrt((front.x - pose.feet.x) * (front.x - pose.feet.x) +
614 (front.z - pose.feet.z) * (front.z - pose.feet.z));
615 if (distance + epsilon < action.minDistance || distance - epsilon > action.maxDistance ||
616 front.normalY + epsilon < action.minSurfaceNormalY) {
617 rejectCandidate();
618 if (debugCapture_ == ClimbingDebugCapture::Enabled)
619 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "geometry_policy_rejected"});
620 continue;
621 }
622 const Vec3 approachNormal = normalizedHorizontal({-front.normalX, 0.f, -front.normalZ});
623 const float heightCenter = (action.minHeight + action.maxHeight) * 0.5f;
624 const std::int64_t score = selectionCost(profile_, action, pose, approachNormal,
625 landing - pose.feet, std::fabs(height - heightCenter),
626 distance) +
627 (previousActionId_ == action.id ? action.repetitionPenalty : 0);
628 if (debugCapture_ == ClimbingDebugCapture::Enabled) {
629 const std::int64_t biasCost = static_cast<std::int64_t>(action.selectionBias) * 1000000ll;
630 const std::int64_t heightCost = quantizeMillimeters(height) * 1000ll;
631 const std::int64_t distanceCost = quantizeMillimeters(distance);
632 boundedDebugPush(lastEvidence_, ClimbingCandidateEvidence{action.id, "accepted", biasCost, heightCost,
633 distanceCost, score});
634 }
635 const static ClimbingCandidate emptyCandidate;
636 ClimbingCandidate& candidate = probeCandidate_;
637 candidate = emptyCandidate;
638 candidate.definitionGeneration = definitionGeneration_;
639 candidate.world = world.runtimeHandle();
640 candidate.obstacleBody = front.body;
641 candidate.obstacleShape = front.shape;
642 candidate.obstacleBodyId = front.bodyId;
643 candidate.obstacleShapeId = front.shapeId;
644 candidate.ignoredBodyId = pose.ignoredBodyId;
645 candidate.frontPoint = {front.x, front.y, front.z};
646 candidate.topPoint = {top.x, top.y, top.z};
647 candidate.landingFeet = landing;
648 candidate.surfaceNormal = {front.normalX, front.normalY, front.normalZ};
649 candidate.surfaceTangent = normalizedHorizontal({front.normalZ, 0.f, -front.normalX});
650 candidate.leftHandAnchor = candidate.topPoint - candidate.surfaceTangent * (action.handSpacing * 0.5f);
651 candidate.rightHandAnchor = candidate.topPoint + candidate.surfaceTangent * (action.handSpacing * 0.5f);
652 candidate.obstacleHeight = height;
653 candidate.obstacleDepth = measuredDepth;
654 candidate.gapDistance = distance;
655 candidate.clearanceHeight = profile_.capsuleHeight;
656 candidate.slopeRadians = topSlope;
657 candidate.curvature = measuredCurvature;
658 candidate.supportShapeTag = top.shapeTag;
659 candidate.supportMaterialId = top.materialId;
660 candidate.probeRecipe = action.probeRecipe;
661 candidate.score = score;
662 candidate.kind = action.kind;
663 candidate.support = support;
664 if (physics::Body3D* body = world.findBody(front.body)) {
665 auto localTop = body->worldToLocalPointOwned(top.x, top.y, top.z);
666 if (!localTop) return eve::Result<void>::failure(localTop.status());
667 auto localLanding = body->worldToLocalPointOwned(landing.x, landing.y, landing.z);
668 if (!localLanding) return eve::Result<void>::failure(localLanding.status());
669 candidate.bodyLocalTop = {localTop.value().x, localTop.value().y, localTop.value().z};
670 candidate.bodyLocalLanding = {localLanding.value().x, localLanding.value().y,
671 localLanding.value().z};
672 }
673 candidates.considerWithActionId(std::move(candidate), action.id);
674 }
675 return finalizeCandidates();
676}
677
679 if (phase_ != ClimbingPhase::Hanging || !execution_)
681 "drop requires a hanging execution", "runtime.phase",
682 {}, "climbing"));
683 if (tick <= execution_->lastTick)
685 "drop tick must be newer than the last execution tick",
686 "tick", {}, "climbing"));
687 auto eventCapacity = requireEventCapacity(1, tick);
688 if (!eventCapacity) return eventCapacity;
689 if (execution_->anchorGraph.isValid()) {
690 auto released = releaseAnchorReservation();
691 if (!released && released.error() && released.error()->code() != eve::DiagnosticCode::StaleHandle &&
692 released.error()->code() != eve::DiagnosticCode::NotFound)
693 return released;
694 }
695 enqueueEvent({ClimbingEventKind::Dropped, execution_->candidate.actionId, tick, execution_->executionId});
696 execution_->velocity = {0.f, -profile_.dropInitialSpeed, 0.f};
697 execution_->lastTick = tick;
698 execution_->candidate.support = HangSupport::None;
699 execution_->compactCollisionActive = false;
700 execution_->branchWindowOpen = false;
702 terminalCode_.clear();
704}
705
707 if (phase_ != ClimbingPhase::Hanging || !execution_)
709 "climb up requires a hanging execution",
710 "runtime.phase", {}, "climbing"));
711 if (tick <= execution_->lastTick)
714 "climb-up tick must be newer than the last execution tick", "tick", {}, "climbing"));
715 const auto found = std::find_if(profile_.actions.begin(), profile_.actions.end(), [&](const auto& action) {
716 return (action.kind == ClimbingActionKind::ClimbUp || action.kind == ClimbingActionKind::Mantle) &&
717 execution_->candidate.obstacleHeight + epsilon >= action.minHeight &&
718 execution_->candidate.obstacleHeight - epsilon <= action.maxHeight;
719 });
720 if (found == profile_.actions.end())
722 "no compatible climb-up action is registered",
723 "profile.actions", {}, "climbing"));
724 if (execution_->anchorGraph.isValid()) {
725 auto released = releaseAnchorReservation();
726 if (!released && released.error() && released.error()->code() != eve::DiagnosticCode::StaleHandle &&
727 released.error()->code() != eve::DiagnosticCode::NotFound)
728 return released;
729 }
730 execution_->candidate.actionId = found->id;
731 execution_->candidate.kind = ClimbingActionKind::ClimbUp;
732 execution_->candidate.definitionGeneration = definitionGeneration_;
733 execution_->definitionGeneration = definitionGeneration_;
734 execution_->action = *found;
735 execution_->startFeet = execution_->currentFeet;
736 execution_->candidate.landingFeet =
737 execution_->candidate.topPoint - execution_->candidate.surfaceNormal * found->landingForward;
738 execution_->elapsed = eve::Duration::zero();
739 execution_->duration = found->duration;
740 execution_->lastTick = tick;
741 execution_->accumulatedResidual = {};
742 execution_->leftContactEmitted = false;
743 execution_->rightContactEmitted = false;
744 execution_->landContactReleased = false;
745 execution_->compactCollisionActive = false;
746 execution_->branchWindowOpen = false;
748 terminalCode_.clear();
750}
751
753 if (!isActivePhase(phase_) || !execution_)
755 "no climbing execution is active", "runtime.phase", {},
756 "climbing"));
757 if (tick < execution_->lastTick)
759 "cancel tick must not precede the last execution tick",
760 "tick", {}, "climbing"));
761 const ClimbingActionDefinition& action = execution_->action;
762 const float t =
763 action.duration.nanoseconds() > 0
764 ? static_cast<float>(std::clamp(execution_->elapsed.seconds() / action.duration.seconds(), 0.0, 1.0))
765 : 0.f;
766 if (phase_ != ClimbingPhase::Hanging && phase_ != ClimbingPhase::Dropping &&
767 (t < action.cancelWindowStart || t > action.cancelWindowEnd))
770 "the active definition does not allow cancellation in this window", "action.cancelWindow", {}, "climbing"));
771 auto eventCapacity = requireEventCapacity(1, tick);
772 if (!eventCapacity) return eventCapacity;
773 if (execution_->anchorGraph.isValid()) {
774 auto released = releaseAnchorReservation();
775 if (!released && released.error() && released.error()->code() != eve::DiagnosticCode::StaleHandle &&
776 released.error()->code() != eve::DiagnosticCode::NotFound)
777 return released;
778 }
779 enqueueEvent({ClimbingEventKind::Cancelled, execution_->candidate.actionId, tick, execution_->executionId});
780 terminalCode_ = reason == ClimbingCancelReason::LinkStale ? "climbing.link.stale"
781 : reason == ClimbingCancelReason::AnchorStale ? "climbing.anchor.stale"
782 : reason == ClimbingCancelReason::MotionBlocked ? "climbing.motion.blocked"
783 : reason == ClimbingCancelReason::WarpBudgetExceeded ? "climbing.warp.budget_exceeded"
784 : "climbing.cancelled";
785 execution_.reset();
788}
789
792 snapshot.phase = phase_;
793 snapshot.candidates = lastCandidates_;
794 snapshot.queryCount = lastQueryCount_;
795 snapshot.terminalCode = terminalCode_;
796 snapshot.queries = lastDebugQueries_;
797 snapshot.evidence = lastEvidence_;
798 snapshot.motion = motionEvidence_;
799 if (execution_) {
800 snapshot.accumulatedWarpResidual = execution_->accumulatedResidual;
801 snapshot.executionId = execution_->executionId;
802 }
803 snapshot.broadPhaseQueryCount = lastCounters_.broadPhaseQueryCount;
804 snapshot.broadPhaseHitCount = lastCounters_.broadPhaseHitCount;
805 return snapshot;
806}
807
809 debugCapture_ = capture;
810 if (capture == ClimbingDebugCapture::Disabled) {
811 lastCandidates_.clear();
812 lastDebugQueries_.clear();
813 lastEvidence_.clear();
814 motionEvidence_.clear();
815 }
816}
817
819 std::uint32_t moverIterations,
820 std::uint64_t elapsedNanoseconds) noexcept {
821 lastQueryCount_ = queryCount;
822 lastCounters_ = {};
823 lastCounters_.workload = ClimbingWorkload::Ordinary;
824 lastCounters_.queryBudget = ClimbingQueryBudgets::Ordinary;
825 lastCounters_.queryCount = queryCount;
826 lastCounters_.moverIterations = moverIterations;
827 if (queryCount > lastCounters_.queryBudget)
828 lastCounters_.budgetState = ClimbingQueryBudgetState::Exceeded;
829 telemetry_.record({tick, elapsedNanoseconds, lastCounters_});
830}
831
832} // namespace eve::climbing
double score
Definition Agent.cpp:51
EVEngine assertion entry point, backed by zeroerr.
#define EV_ASSERT(cond,...)
Assert an internal engine invariant (state that must always hold).
Definition Assert.h:37
std::string output
eve::EntitySpatialPose pose
Versioned, lossless codecs for climbing definitions.
Deterministic climbing/parkour planning and capsule-constrained execution.
std::vector< std::string > fields
Definition ECS.cpp:42
DiagnosticCode code
ShaderImageInput shape
glm::vec4 clip
HexVec3 left
HexVec3 right
std::int32_t c
std::uint32_t height
bool ordered
size_t offset
bool valid
MeleePoint3 b
Definition MeleeHit.cpp:41
MeleePoint3 a
Definition MeleeHit.cpp:40
float distance
Texture * normal
std::vector< particles::ParticleRecordEvent > events
std::string action
Definition PlayHost.cpp:118
bool hit
std::string body
float t
std::string slot
Heightmap ground
bool found
std::string filter
size_t end
std::map< std::array< int, 4 >, std::vector< const Subject * > > candidates
Definition Sensing.cpp:32
int count
SimulationTick tick
int limit
Definition TreeMesh.cpp:166
int sides
Definition TreeMesh.cpp:459
V forward
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
static constexpr Duration zero() noexcept
Return zero duration.
Definition Time.h:60
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
Keyframed skeletal animation clip (local TRS tracks per bone). Script type: AnimClip.
Definition AnimClip.h:145
Fixed-capacity owning candidate set used by the production probe hot path.
Definition Climbing.h:329
void consider(ClimbingCandidate candidate)
Consider one candidate and retain it only when it belongs to the best fixed-capacity set.
Definition Climbing.cpp:40
void considerWithActionId(const ClimbingCandidate &candidate, std::string_view actionId)
Consider a candidate while reusing slot-owned action-id storage on the production probe path.
Definition Climbing.cpp:46
void swap(ClimbingCandidateSet &other) noexcept
Exchange complete owning slot storage without allocating.
Definition Climbing.cpp:73
void sortAndLimit(std::size_t limit)
Sort by canonical deterministic selection key and clamp to a validated limit.
Definition Climbing.cpp:66
static constexpr std::size_t Capacity
Definition Climbing.h:331
void clear() noexcept
Remove all candidates while retaining each slot's owned string capacity.
Definition Climbing.h:334
ClimbingDebugSnapshot inspect() const
Captures the latest bounded owning diagnostics without querying Physics.
Definition Climbing.cpp:790
eve::Result< void > setProfile(ClimbingProfile profile)
Replaces the runtime profile after validating all dimensions and action definitions.
Definition Climbing.cpp:106
eve::Result< void > drop(eve::SimulationTick tick)
Enters an explicit physics-constrained drop from a hanging pose.
Definition Climbing.cpp:678
void recordOrdinaryTick(eve::SimulationTick tick, std::uint32_t queryCount=0, std::uint32_t moverIterations=0, std::uint64_t elapsedNanoseconds=0) noexcept
Record one ordinary locomotion tick and its bounded Physics mover work.
Definition Climbing.cpp:818
ClimbingLocomotionPolicy locomotionPolicy() const noexcept
Return an owning ordinary-locomotion policy snapshot safe across later profile reloads.
Definition Climbing.cpp:110
eve::Result< eve::Value > snapshot() const
Captures deterministic runtime state; debug candidates and final bone poses are excluded.
eve::Result< std::vector< ClimbingEvent > > drainEvents()
Atomically takes all events queued by simulation operations in stable production order.
Definition Climbing.cpp:99
eve::Result< ClimbingCandidateSet > probe(physics::World3D &world, const ClimbingPose &pose) const
Probes, validates, and deterministically sorts all matching candidates.
Definition Climbing.cpp:179
eve::Result< void > probeInto(physics::World3D &world, const ClimbingPose &pose, ClimbingCandidateSet &output, eve::SimulationTick tick=eve::SimulationTick::zero()) const
Probe into caller-retained fixed storage; successful calls atomically replace output.
Definition Climbing.cpp:187
eve::Result< void > validateAnimationBinding(std::string_view actionId, const animation::AnimClip &clip)
Validates and records an action's clip notify contract without retaining the clip.
Definition Climbing.cpp:158
eve::Result< void > cancel(ClimbingCancelReason reason, eve::SimulationTick tick)
Cancels an active execution with an injected tick and stable, strongly typed reason.
Definition Climbing.cpp:752
eve::Result< void > climbUp(eve::SimulationTick tick)
Branches from hanging into the best compatible mantle/climb-up definition.
Definition Climbing.cpp:706
eve::Result< void > upsertAction(ClimbingActionDefinition action)
Adds or replaces one action definition by stable id.
Definition Climbing.cpp:139
static constexpr std::size_t PendingEventCapacity
Hard bound for undelivered post-simulation events owned by one runtime.
Definition Climbing.h:666
void setDebugCapture(ClimbingDebugCapture capture) noexcept
Enables or disables bounded diagnostic capture; disabling immediately releases captured data.
Definition Climbing.cpp:808
Backend-neutral 3D rigid body in meter-space coordinates (+Y up by convention). Owned by a World3D; c...
Definition Body3D.h:31
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:47
SQInteger top
Definition Snapshot.cpp:115
bool isActionEnabledForPose(const ClimbingProfile &profile, const ClimbingActionDefinition &action, const ClimbingPose &pose)
True when action enabled for pose.
std::int64_t selectionCost(const ClimbingProfile &profile, const ClimbingActionDefinition &action, const ClimbingPose &pose, Vec3 targetDirection, Vec3 targetDelta, float heightError, float distance, std::int64_t stableTieBreak=0)
Selection cost.
bool isCandidateLess(const ClimbingCandidate &lhs, const ClimbingCandidate &rhs)
True when candidate less.
bool isRuntimeProbeKind(ClimbingActionKind kind)
True when runtime probe kind.
const ClimbingActionDefinition * findAction(const ClimbingProfile &profile, std::string_view id)
Optional action. @borrowed From profile; lifetime ends when the caller-owned profile changes or is de...
std::int64_t quantizeMillimeters(float value)
Quantize millimeters.
Vec3 normalizedHorizontal(Vec3 value)
Normalized horizontal.
bool isProbeRecipeMatchingKind(const ClimbingActionDefinition &action)
True when probe recipe matching kind.
float lengthSquared(Vec3 value)
Length squared.
bool isSupportSelectorMatch(const ClimbingActionDefinition &action, int shapeTag, int materialId)
True when support selector match.
bool isFinite(float value)
True when finite.
void boundedDebugPush(std::vector< T > &values, T value)
Bounded debug push.
bool isObstacleProbeKind(ClimbingActionKind kind)
True when obstacle probe kind.
bool isActivePhase(ClimbingPhase phase)
True when active phase.
ClimbingCancelReason
Stable, strongly typed terminal cancellation reason.
Definition Climbing.h:140
ClimbingDebugCapture
Runtime policy controlling optional owning diagnostic capture.
Definition Climbing.h:606
eve::Result< void > validateClimbingActionDefinition(const ClimbingActionDefinition &action)
Validate every known field of one action definition.
HangSupport
Evidence describing whether a hanging pose has foot support.
Definition Climbing.h:137
eve::Result< void > validateClimbingProfileDefinition(const ClimbingProfileDefinition &profile)
Validate every known field and nested action of one profile definition.
StatusCode
Stable outcome category for an operation.
Definition Status.h:28
Definition of one geometry-compatible climbing action.
Definition Climbing.h:160
Quantized selection cost and hard-decision evidence for one action definition.
Definition Climbing.h:619
Owning, replayable climbing candidate; contains no borrowed query pointers.
Definition Climbing.h:290
ClimbingProbeRecipe probeRecipe
Definition Climbing.h:317
std::uint64_t definitionGeneration
Definition generation used to produce this candidate.
Definition Climbing.h:293
physics::PhysicsWorldHandle world
Definition Climbing.h:294
physics::PhysicsBodyHandle obstacleBody
Definition Climbing.h:295
physics::PhysicsShapeHandle obstacleShape
Definition Climbing.h:296
Geometry-query evidence suitable for an engine debug-draw adapter.
Definition Climbing.h:609
Bounded owning debug snapshot, independent of Physics query caches.
Definition Climbing.h:639
Small owning projection of profile fields consumed by ordinary ground/air locomotion.
Definition Climbing.h:261
Input pose used for one deterministic candidate probe.
Definition Climbing.h:275
Runtime profile controlling capsule geometry and probe limits.
Definition Climbing.h:218
physics::QueryFilter3D queryFilter
Definition Climbing.h:254
std::vector< ClimbingActionDefinition > actions
Definition Climbing.h:255
static constexpr std::uint32_t CandidateProbe
static constexpr std::uint32_t Ordinary
Small owning world-space vector used at climbing module boundaries.
One generation-qualified shape returned by an owning broad-phase query.
Query filter applied atomically for one owning query operation.
Owning snapshot of the closest ray intersection.
PhysicsShapeHandle shape
PhysicsBodyHandle body