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

fromMatrix4

说明

fromMatrix4方法会将给定的4x4矩阵转换为3x3矩阵。

语法

Matrix3.fromMatrix4(matrix)

参数

  • matrix:一个长度为16的数组表示的4x4矩阵。

返回值

返回一个新的Matrix3对象,代表从给定的4x4矩阵中提取出的3x3矩阵。

示例

const matrix4 = [
  1, 0, 0, 2,
  0, 1, 0, 3,
  0, 0, 1, 4,
  0, 0, 0, 1
];
const matrix3 = Matrix3.fromMatrix4(matrix4);

console.log(matrix3.toArray()); // [1, 0, 0, 0, 1, 0, 0, 0, 1]

版本要求

该方法自Yuka 1.0.0版本引入。

参考文献

作者

该方法由Yuka.js库的作者编写。

执照

Yuka.js库根据MIT许可获得许可。详见LICENSE文件。