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

makeBasis

描述

makeBasis函数是Matrix3类的一个静态方法,用于产生一个基础的3x3矩阵。

语法

Matrix3.makeBasis(xAxis, yAxis, zAxis)

参数

  • xAxisVector3类型数组,表示矩阵的x轴。
  • yAxisVector3类型数组,表示矩阵的y轴。
  • zAxisVector3类型数组,表示矩阵的z轴。

返回值

返回一个Matrix3类型的3x3矩阵。

异常

如果参数不是Vector3类型数组,将抛出一个类型错误。

例子

const xAxis = new Vector3(1,0,0);
const yAxis = new Vector3(0,1,0);
const zAxis = new Vector3(0,0,1);

const basis = Matrix3.makeBasis(xAxis, yAxis, zAxis);

console.log(basis.elements); // [1,0,0,0,1,0,0,0,1]

该例子将产生一个基础的3x3矩阵,其中x轴是(1,0,0),y轴是(0,1,0),z轴是(0,0,1)。执行后打印出矩阵的元素数组[1,0,0,0,1,0,0,0,1]。

参考