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

extractBasis

描述

extractBasisMatrix3 类的一个方法,在三维空间中提取一个 Matrix3 对象的基向量。基向量是指该 Matrix3 对象的三个列向量。

语法

extractBasis(matrix: Matrix3, xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): void

参数

  • matrix:要提取基向量的 Matrix3 对象
  • xAxis:用于存储该 Matrix3 对象的第一个列向量的 Vector3 对象
  • yAxis:用于存储该 Matrix3 对象的第二个列向量的 Vector3 对象
  • zAxis:用于存储该 Matrix3 对象的第三个列向量的 Vector3 对象

示例

import { Matrix3, Vector3 } from 'yuka';

const matrix = new Matrix3().fromRotationY(Math.PI / 2);

const xAxis = new Vector3();
const yAxis = new Vector3();
const zAxis = new Vector3();

matrix.extractBasis(xAxis, yAxis, zAxis);

console.log(xAxis); // 输出:(1, 0, 0)
console.log(yAxis); // 输出:(0, 0, 1)
console.log(zAxis); // 输出:(0, 0, -1)

参考