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

clearSubgoals

简介

clearSubgoals 方法是 Yuka.js 中 CompositeGoal 类的一个成员方法。CompositeGoal 代表了一个由多个子目标组成的目标,用于指导智能体的行动。

clearSubgoals 方法用于清空 CompositeGoal 实例的子目标列表,以准备添加新的子目标。

语法

compositeGoal.clearSubgoals();

参数

此方法不接受任何参数。

返回值

此方法不返回任何值。

示例

const yuka = require('yuka');
const { CompositeGoal } = yuka;

const compositeGoal = new CompositeGoal();
compositeGoal.addSubgoal(someGoal);

compositeGoal.clearSubgoals();

注意事项

  • clearSubgoals 方法将清空所有子目标,因此在使用该方法之前应该确保子目标列表没有被使用。
  • 如果 CompositeGoal 实例目前没有任何子目标,此方法将不会有任何效果。

参考文献