Buffalo Posted January 15, 2015 Share Posted January 15, 2015 So it's possible to use OOP matrices and vectors without actually enabling OOP in meta file according to wiki. How would following example look with these conditions without OOP enabled? (Curiosity) local positionBelow = vehicle.position - vehicle.matrix.up Link to comment
Moderators IIYAMA Posted January 15, 2015 Moderators Share Posted January 15, 2015 https://wiki.multitheftauto.com/wiki/GetElementMatrix Take a look at the examples. Wiki source: This example creates some more matrix utility functions function getMatrixLeft(m) return m[1][1], m[1][2], m[1][3] end function getMatrixForward(m) return m[2][1], m[2][2], m[2][3] end function getMatrixUp(m) return m[3][1], m[3][2], m[3][3] end function getMatrixPosition(m) return m[4][1], m[4][2], m[4][3] end local mat = getElementMatrix(element) -- Get the matrix x,y,z = getMatrixLeft(mat) -- Get the matrix left direction x,y,z = getMatrixForward(mat) -- Get the matrix forward direction x,y,z = getMatrixUp(mat) -- Get the matrix up direction Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now