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

概述

Yuka js库中的WanderBehavior类是一种运动行为,用于在给定区域内随机移动。

该类提供了从JSON对象中加载数据的方法,称为fromJSON。

使用方法

let behavior = new YUKA.WanderBehavior();
let data = { radius: 10, distance: 20, jitter: 2 };
behavior.fromJSON( data );

参数说明

参数名 类型 默认值 描述
radius Number 10 随机移动半径
distance Number 20 随机移动距离控制器的长度
jitter Number 2 控制随机位置位移的因素

数据格式

const data = {
  radius: 10,
  distance: 20,
  jitter: 2
};

radius

  • 数据类型: Number
  • 描述: 随机移动半径

distance

  • 数据类型: Number
  • 描述: 随机移动距离控制器的长度

jitter

  • 数据类型: Number
  • 描述: 控制随机位置位移的因素

返回值

无返回值。