载入中...
搜索中...
未找到
ClimbingAnchorExecution.cpp
浏览该文件的文档.
19Vec3 scale(Vec3 value, float amount) { return {value.x * amount, value.y * amount, value.z * amount}; }
20float length(Vec3 value) { return std::sqrt(value.x * value.x + value.y * value.y + value.z * value.z); }
23 return phase != ClimbingPhase::Idle && phase != ClimbingPhase::Completed && phase != ClimbingPhase::Cancelled &&
27const ClimbingActionDefinition* findAction(const ClimbingProfileDefinition& profile, std::string_view id) {
35 return actionKind == ClimbingActionKind::LadderMount || actionKind == ClimbingActionKind::LedgeGrab;
39 return actionKind == ClimbingActionKind::LedgeGrab || actionKind == ClimbingActionKind::ClimbDown;
46 return actionKind == ClimbingActionKind::CornerInner || actionKind == ClimbingActionKind::CornerOuter;
54 return actionKind == ClimbingActionKind::PoleSwing || actionKind == ClimbingActionKind::BarSwing;
59bool tagsContain(const std::vector<std::string>& values, const std::vector<std::string>& required) {
73eve::Result<void> validatePath(physics::World3D& world, Vec3 start, const ClimbingCandidate& candidate,
80 const float t = static_cast<float>(segment) / static_cast<float>(profile.pathValidationSegments);
92 eve::Diagnostic::error(eve::DiagnosticCode::PreconditionViolation, "climbing.anchor.path_blocked",
99eve::Result<ClimbingCandidate> makeCandidate(physics::World3D& world, ClimbingAnchorGraphInstance& graph,
107 eve::Diagnostic::error(eve::DiagnosticCode::StaleHandle, "anchor graph target body is stale", "graph.body",
132 auto localTop = body->worldToLocalPointOwned(node.position.x, node.position.y, node.position.z);
134 auto localLanding = body->worldToLocalPointOwned(candidate.landingFeet.x, candidate.landingFeet.y,
138 candidate.bodyLocalLanding = {localLanding.value().x, localLanding.value().y, localLanding.value().z};
176 if (!execution_ || !execution_->anchorGraph.isValid() || execution_->anchorReservation.id.isZero())
178 eve::Diagnostic::error(eve::DiagnosticCode::NotFound, "active execution is not bound to an anchor graph",
184 physics::World3D& world, ClimbingAnchorGraphHandleRef graphReference, const ClimbingAnchorNodeRef& nodeReference,
185 ClimbingAnchorAgentId agentId, std::string_view actionId, const ClimbingPose& pose, eve::SimulationTick tick) {
196 eve::DiagnosticCode::InvalidArgument, "anchor execution requires a stable non-zero agent id", "agentId", {},
201 eve::Diagnostic::error(eve::DiagnosticCode::StaleHandle, "anchor graph instance handle is stale", "graph",
208 eve::DiagnosticCode::InvalidArgument, "action kind cannot approach the requested anchor node", "actionId",
215 auto candidate = makeCandidate(world, *graph, resolved.value(), *action, profile_, pose, definitionGeneration_);
220 eve::DiagnosticCode::PreconditionViolation, "anchor approach lies outside the action geometry range",
259 eve::DiagnosticCode::PreconditionViolation, "anchor transition requires a graph-bound hanging execution",
267 eve::DiagnosticCode::Conflict, "anchor transition tick must be newer than the last execution tick", "tick",
272 eve::Diagnostic::error(eve::DiagnosticCode::StaleHandle, "anchor graph instance handle is stale",
278 const auto edge = std::find_if(edges.value().begin(), edges.value().end(), [&](const auto& candidate) {
283 eve::DiagnosticCode::NotFound, "no authored edge connects the current and requested anchors", "target", {},
288 return eve::Result<void>::failure(eve::Diagnostic::error(eve::DiagnosticCode::PreconditionViolation,
306 auto candidate = makeCandidate(world, *graph, resolved.value(), *action, profile_, pose, definitionGeneration_);
312 eve::DiagnosticCode::PreconditionViolation, "anchor transition lies outside the action geometry range",
Deterministic climbing/parkour planning and capsule-constrained execution.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
eve::Result< void > transitionAnchor(physics::World3D &world, const ClimbingAnchorNodeRef &target, ClimbingAnchorEdgeKind edgeKind, std::string_view actionId, eve::SimulationTick tick)
Atomically moves a hanging graph execution to a reserved adjacent node.
Definition ClimbingAnchorExecution.cpp:250
~ClimbingRuntime() noexcept
Releases any live anchor reservation before runtime storage is destroyed.
Definition ClimbingAnchorExecution.cpp:144
eve::Result< ClimbingCandidate > tryBeginAnchor(physics::World3D &world, ClimbingAnchorGraphHandleRef graph, const ClimbingAnchorNodeRef &node, ClimbingAnchorAgentId agentId, std::string_view actionId, const ClimbingPose &pose, eve::SimulationTick tick)
Begins an authored graph anchor using the same authoritative execution lifecycle.
Definition ClimbingAnchorExecution.cpp:183
eve::Result< ClimbingAnchorNodeRef > currentAnchor() const
Returns the current graph node reference, or NotFound when execution is probe-only.
Definition ClimbingAnchorExecution.cpp:175
ClimbingExecutionId executionId() const noexcept
Current execution identity, or zero when no execution is active or retained.
Definition Climbing.h:805
static eve::script::Borrowed< ClimbingAnchorGraphInstance > resolveAnchorGraph(ClimbingAnchorGraphHandleRef reference) noexcept
Resolves a live graph instance as a synchronous non-owning observation.
Definition ClimbingRegistry.cpp:40
constexpr std::uint64_t value() const noexcept
Returns the underlying value at an explicit protocol boundary.
Definition StrongUint64.h:26
constexpr bool isZero() const noexcept
Returns whether this value is zero.
Definition StrongUint64.h:28
Box3D rigid-body world. Script coordinates are meters (Box3D native), unlike 2D World which uses pixe...
Definition World3D.h:63
Vec3 trajectoryPoint(Vec3 start, const ClimbingCandidate &candidate, const ClimbingActionDefinition &action, const ClimbingProfileDefinition &profile, float normalizedTime) noexcept
Trajectory point.
Definition ClimbingTrajectory.h:28
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...
Definition ClimbingRuntimeInternal.h:192
constexpr float epsilon
Definition ClimbingRuntimeInternal.h:13
Definition Climbing.cpp:19
ClimbingAnchorEdgeKind
Allowed authored transition between two explicit anchors.
Definition ClimbingAnchorGraph.h:34
ClimbingAnchorKind
Authored semantic of one explicit climbing anchor.
Definition ClimbingAnchorGraph.h:31
@ LadderRung
ClimbingPhase
Execution lifecycle visible to gameplay and animation adapters.
Definition Climbing.h:470
@ Completed
@ Swinging
@ Cancelled
@ Balanced
@ Launching
@ AnchorTransitionStarted
ClimbingActionKind
Data-driven action family; stable action identity remains the definition id.
Definition Climbing.h:46
@ LedgeGrab
@ ClimbDown
@ LadderMount
@ PoleSwing
@ LadderDismount
@ LadderClimb
@ CornerInner
@ BeamBalance
@ CornerOuter
@ LedgeJump
@ InvalidArgument
@ NotFound
@ PreconditionViolation
@ StaleHandle
@ Conflict
@ NoOp
@ Applied
Definition of one geometry-compatible climbing action.
Definition Climbing.h:160
Generation-qualified reference to an authored anchor node.
Definition ClimbingAnchorGraph.h:121
Input pose used for one deterministic candidate probe.
Definition Climbing.h:275