Last active
September 18, 2023 09:07
-
-
Save JokerMartini/59cb9078b59cb4f5dac1 to your computer and use it in GitHub Desktop.
Maxscript: Mirrors and object's matrix across an axis in 3ds Max.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--Create a point | |
p=point pos:[-20,0,0] size:20 axistripod:true box:true | |
--Rotate it 90 in z | |
rotate p (eulerAngles 0 0 45) | |
--Get the transform matrix to work with. | |
tm=p.transform | |
--Mirror the tm across the world matrix in x | |
mirroredTm=tm*(scaleMatrix [-1,1,1]) | |
--Set the transform just so you can see what it has done. | |
at time 10 | |
animate on | |
p.transform=mirroredTm | |
--Mirror the mirrorTm in local space but this time on the y axis. This would be known as flipping the y. | |
finalTm=(scaleMatrix [1,-1,1])*mirroredTm | |
--Set the transform back to the object. | |
at time 20 | |
animate on | |
p.transform=finalTm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete cameras | |
-- frontCam = Inverse(viewport.getTM()) | |
frontTM = (matrix3 [0.936672,0.350207,0] [-0.13119,0.350883,0.927184] [0.324707,-0.868468,0.374607] [909.75,-2617.23,1404.43]) | |
Freecamera transform:frontTM | |
fn flip_matrix tm = | |
( | |
--Mirror the tm across the world matrix in xy | |
mirroredTm = tm*(scaleMatrix [-1,-1,1]) | |
--Mirror the mirrorTm in local space but this time on the y axis. This would be known as flipping the y. | |
finalTm = (scaleMatrix [1,1,1])*mirroredTm | |
--Return the transform | |
finalTm | |
) | |
Freecamera transform:(flip_matrix frontTM) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment