AABB
AlignmentBehavior
ArriveBehavior
AStar
BFS
BoundingSphere
BVH
BVHNode
Cell
CellSpacePartitioning
CohesionBehavior
CompositeGoal
ConvexHull
Corridor
CostTable
DFS
Dijkstra
Edge
EntityManager
EvadeBehavior
EventDispatcher
Behavior
FollowPathBehavior
FuzzyAND
FuzzyCompositeTerm
FuzzyFAIRLY
FuzzyModule
FuzzyOR
FuzzyRule
FuzzySet
FuzzyTerm
FuzzyVariable
FuzzyVERY
GameEntity
Goal
GoalEvaluator
Graph
GraphUtils
HalfEdge
HeuristicPolicyDijkstra
HeuristicPolicyEuclid
HeuristicPolicyEuclidSquared
HeuristicPolicyManhattan
InterposeBehavior
LeftSCurveFuzzySet
LeftShoulderFuzzySet
LineSegment
Logger
MathUtils
Matrix3
Matrix4
MemoryRecord
MemorySystem
MeshGeometry
MessageDispatcher
MovingEntity
NavEdge
NavMesh
NavMeshLoader
NavNode
Node
NormalDistFuzzySet
OBB
ObstacleAvoidanceBehavior
OffsetPursuitBehavior
OnPathBehavior
Path
Plane
Polygon
Polyhedron
PriorityQueue
PursuitBehavior
Quaternion
Ray
RectangleTriggerRegion
Regular
RightSCurveFuzzySet
RightShoulderFuzzySet
SAT
SeekBehavior
SeparationBehavior
SingletonFuzzySet
Smoother
SphericalTriggerRegion
State
StateMachine
SteeringBehavior
SteeringManager
Task
TaskQueue
Telegram
Think
Time
TriangularFuzzySet
Trigger
TriggerRegion
Vector3
Vehicle
Version
WanderBehavior

replanIfFailed

replanIfFailed是Yuka js库中的一种 复合目标(Composite Goal) 策略。如果现有目标失败或被中止,该策略将尝试重新规划并选择一个新的子目标以达到整体目标。

用法

import { replanIfFailed } from 'yuka';

// 创建一个复合目标
const compositeGoal = new CompositeGoal();

// 添加子目标
compositeGoal.addChild( subGoal1 );
compositeGoal.addChild( subGoal2 );
compositeGoal.addChild( subGoal3 );

// 设置策略为replanIfFailed
compositeGoal.strategy = replanIfFailed;

在上述示例中,如果任何一个子目标失败,则Yuka js库将重新规划并选择新的子目标以重新开始该复合目标。

注意事项

  • replanIfFailed 策略需要子目标提供足够的信息来重新规划并选择新目标,以确保目标可以成功完成。
  • 如果没有提供新的子目标进行重新规划,则复合目标将被标记为失败并停止。

参考资料