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

fromJSON

描述

fromJSON是NavEdge对象的一个方法,用于将JSON格式的字符串转换为NavEdge对象。

语法

NavEdge.fromJSON(jsonString)

参数

  • jsonString:必需,要转换为NavEdge对象的JSON格式字符串。

返回值

返回转换后的NavEdge对象。

示例

JavaScript代码

const jsonString = '{"name": "Home", "children": [{"name": "Kitchen", "children": []}, {"name": "Bedroom", "children": [{"name": "Closet", "children": []}]}]}';
const navEdge = NavEdge.fromJSON(jsonString);
console.log(navEdge);

输出

NavEdge {name: "Home", children: Array(2)}
    children: Array(2)
        0: NavEdge {name: "Kitchen", children: Array(0)}
        1:
            children: Array(1)
                0: NavEdge {name: "Closet", children: Array(0)}
            name: "Bedroom"
            __proto__: Object
    name: "Home"
    __proto__: Object

备注

  • 如果jsonString无法被解析为合法的NavEdge对象,则会抛出一个错误。