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

AlignmentBehavior 类的静态方法,用于将 JSON 数据解析为对齐行为对象。

语法

AlignmentBehavior.fromJSON(json)

参数

  • json: 解析为对齐行为对象的 JSON 数据。

返回值

对齐行为对象。

示例

const json = {
  type: 'alignment',
  options: {
    verticalAlign: 'center',
    horizontalAlign: 'left'
  }
};

const behavior = AlignmentBehavior.fromJSON(json);
console.log(behavior); // AlignmentBehavior { verticalAlign: 'center', horizontalAlign: 'left' }

注意事项

  • json 参数必须是包含 typeoptions 属性的 JSON 对象。
  • type 属性的值必须为 alignment
  • options 属性必须包含 verticalAlignhorizontalAlign 属性,分别表示垂直和水平方向的对齐方式。可选值为 topmiddlebottomleftcenterright