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

worldMatrix

worldMatrix 属性用于获取或设置车辆在全局坐标系中的变换矩阵。

语法

vehicle.worldMatrix

返回值

  • 返回 Float32Array 类型的数组,表示车辆在全局坐标系中的变换矩阵。

示例

// 获取车辆在全局坐标系中的变换矩阵
const worldMatrix = vehicle.worldMatrix;

// 设置车辆在全局坐标系中的变换矩阵
const newWorldMatrix = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 5, 2, 0, 1]);
vehicle.worldMatrix = newWorldMatrix;

备注

  • worldMatrix 属性的数据类型为 Float32Array 数组,长度为 16。其中,前 12 个元素为车辆在全局坐标系中的旋转矩阵,后 4 个元素表示车辆在全局坐标系中的平移矩阵。在设置 worldMatrix 属性时,必须传入长度为 16 的 Float32Array 数组。
  • Vehicle 对象创建后,初始的 worldMatrix 属性值为单位矩阵。

参考链接