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

getEdgesOfNode

描述

该方法用于返回节点的出边数组,其中每条出边都是由源节点指向目标节点的。

语法

graph.getEdgesOfNode(node);

参数

  • node:必填参数,表示待查询的节点。

返回值

返回一个数组,包含目标节点与源节点之间的出边,每个出边都是以Edge类型返回。

示例

const graph = new Yuka.Graph();

const node1 = new Yuka.Node();
const node2 = new Yuka.Node();
const edge = new Yuka.Edge(node1, node2);

graph.addEdge(edge);

const edgesOfNode1 = graph.getEdgesOfNode(node1);
console.log(edgesOfNode1); // 输出 [edge]

异常

  • 如果参数node为空,将抛出异常Node is not defined.

备注

  • 如果需要正确的出边列表,请确保既提供了源节点,也提供了目标节点。例如,在实例化Edge时,node1指向node2,不要将其视为node2的入边。