-
Notifications
You must be signed in to change notification settings - Fork 7
Matrix Utilities
Swifter edited this page Oct 9, 2024
·
9 revisions
You should know about how matrices work mathematically. Here is a great resource where you can learn about them: https://www.youtube.com/watch?v=fNk_zzaMoSs&list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab
You should read Transform Utilities first to understand how rm.Transform objects work.
"Matrices" in ReMapper use the Matrix4 class from threejs. This is mainly for it's functionality of being able to compose and decompose euler rotations from matrices.
-
rm.getMatrixFromTransformwill take in arm.Transformand give the correspondingthree.Matrix4that represents that transformation.
rm.getMatrixFromTransform({
position: [0, 10, 0],
scale: [2, 2, 2]
})
/*
2, 0, 0, 0
0, 2, 0, 10
0, 0, 2, 0,
0, 0, 0, 1
*/-
rm.getTransformFromMatrixwill take in athree.Matrix4and give the correspondingrm.Transformthat represents that transformation. Do note that any non-orthogonal matrices will not translate correctly.
const matrix = new rm.three.Matrix4(
2, 0, 0, 0,
0, 2, 0, 10,
0, 0, 2, 0,
0, 0, 0, 1
)
rm.getTransformFromMatrix(matrix)
/*
{
position: [0, 10, 0],
rotation: [0, 0, 0],
scale: [2, 2, 2]
}
*/-
rm.matrixFromBasisVectorswill create athree.Matrix4from 3rm.Vec3s which represent the X, Y, and Z axis after the transformation.
// 90 degree rotation, 2x scale
const matrix = rm.matrixFromBasisVectors(
[0, 0, -2],
[0, 2, 0],
[2, 0, 0]
)
rm.getTransformFromMatrix(matrix)
/*
{
position: [0, 0, 0],
rotation: [0, 90, 0],
scale: [2, 2, 2]
}
*/-
rm.applyMatrixToPointtakes athree.Matrix4and applies it's transformation to arm.Vec3.
// 90 degree rotation, 2x scale
const matrix = rm.getMatrixFromTransform({
rotation: [0, 90, 0],
scale: [2, 2, 2]
})
rm.applyMatrixToPoint(matrix, [0, 0, 1]) // ~ [2, 0, 0]- Info
- Difficulty
- Beatmap Objects
- Gameplay Objects
- Walls
- Basic Notemods
- Note Iterators
- Basic Events
- V3 Events
- Custom Events
- Heck Tracks and Animation
- Easings
- Point Types
- Point Utilities
- Heck Animation Baking
- Heck Animation Settings
Non-Vivify Models
Vivify