pa3ck Posted November 29, 2013 Share Posted November 29, 2013 Hi there, I'm trying to script some jobs, the first one is the delivery guy. What I want to do is, that a CP will be created behind the car, at the boot. It would be easy if the rotation of the car would not change, but it obviously changes, what would be the best way to do this? Link to comment
bandi94 Posted November 29, 2013 Share Posted November 29, 2013 getElementMatrix - will have every time the same x,y,z offset position no mather of the rotation , and after use attachElements Link to comment
pa3ck Posted November 29, 2013 Author Share Posted November 29, 2013 Thanks for your help, but I have a little problem with it. This is a pic of the problem: http://i.imgur.com/2UreMY8.jpg and my code is: addCommandHandler("matrix", function() 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 veh = getPedOccupiedVehicle(localPlayer) local mat = getElementMatrix(veh) local ax, ay, az = getElementPosition(veh) vx,vy,vz = getMatrixForward(mat) cp = createMarker(ax, ay, az, "checkpoint", 1) attachElements(cp, veh, vx, vy - 6, vz) end) I dont know if I'm on the right track... Link to comment
Castillo Posted November 29, 2013 Share Posted November 29, 2013 What is the problem? Link to comment
pa3ck Posted November 29, 2013 Author Share Posted November 29, 2013 The problem is, that the position of the marker changes, so the marker is not exactly at the boot, as it's on the ss. 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