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

SphericalTriggerRegionfromJSON方法解析JSON格式的数据,并使用数据创建新的SphericalTriggerRegion对象。

语法

SphericalTriggerRegion.fromJSON(json: Object): SphericalTriggerRegion

参数

  • json:一个包含SphericalTriggerRegion数据的JSON对象。

返回值

  • SphericalTriggerRegion:一个新的SphericalTriggerRegion对象。

示例

// JSON object
const json = {
  type: "spherical",
  center: [0, 0, 0],
  radius: 10
};

// Create a new SphericalTriggerRegion from JSON
const region = SphericalTriggerRegion.fromJSON(json);

JSON格式

fromJSON方法需要的JSON格式如下:

{
  "type": "spherical",
  "center": [x, y, z],
  "radius": radius
}
  • type:表示区域类型,应为字符串spherical
  • center:表示球心坐标,应为长度为3的数字数组。
  • radius:表示球体半径,应为数字。