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

getInverse

介绍

getInverse方法返回该 Matrix4 对象的逆矩阵。

语法

matrix4.getInverse()

返回值

返回值为 Matrix4 对象的逆矩阵。

示例

以下示例获取一个 Matrix4 对象的逆矩阵:

const matrix = new Yuka.Matrix4();
// 填充矩阵...
const inverseMatrix = matrix.getInverse();

注意事项

  • 如果该 Matrix4 对象是一个奇异矩阵(不可逆),则返回的结果为 null
  • 调用 getInverse 方法不会更改原始矩阵,而是返回新的逆矩阵。
  • 可以使用 Matrix4.multiplyMatrices 方法来验证返回的逆矩阵是否正确。即将原始矩阵和逆矩阵相乘,如果乘积为单位矩阵,则逆矩阵是正确的。

参考链接