koeno100 Posted February 26, 2015 Share Posted February 26, 2015 (edited) Hey guys I have a problem with the setElementRotation function. I draw a line for the x, y and z axis from the object's center (Just like the map editor does), but for example, if I set the rotation of my x and z axis to 0, and the y axis to 180, and then use getElementRotation to get the values, the x and z axis are 180 degrees, and the y axis is 0 degrees. Does anyone know how to prevent this? This is what I mean: https://www.dropbox.com/s/d7ikx0lh9t3do ... d.mp4?dl=0 function drawTheVehicleAxisArrows() rotation = rotation + 1 setElementRotation(theCreatedVehicle, 0, 0, rotation) local x, y, z = getElementPosition(theCreatedVehicle) local rx, ry, rz = getElementRotation(theCreatedVehicle) _, miny, _, _, maxy, _ = getElementBoundingBox(theCreatedVehicle) cosz = math.cos(math.rad(rz)) sinz = math.sin(math.rad(rz)) outputChatBox(rx.. " " ..ry.. " " ..rz) cosy = math.cos(math.rad(ry)) siny = math.sin(math.rad(ry)) maxy = maxy + 1 dxDrawLine3D(x, y, z, x, y, z + maxy, tocolor(0, 0, 255, 255), 10) dxDrawLine3D(x, y, z + maxy - 0.05, x, y - 0.25, z + maxy - 0.3, tocolor(0, 0, 255, 255), 10) dxDrawLine3D(x, y, z + maxy - 0.05, x, y + 0.25, z + maxy - 0.3, tocolor(0, 0, 255, 255), 10) dxDrawLine3D(x, y, z, x + cosz * maxy, y + sinz * maxy, z + siny * maxy, tocolor(255, 0, 0, 255), 10) dxDrawLine3D(x + cosz * maxy - 0.05, y + sinz * maxy, z, x + cosz * maxy - cosz * 0.3, y + sinz * maxy - sinz * 0.3, z - 0.25, tocolor(255, 0, 0, 255), 10) dxDrawLine3D(x + cosz * maxy - 0.05, y + sinz * maxy, z, x + cosz * maxy - cosz * 0.3, y + sinz * maxy - sinz * 0.3, z + 0.25, tocolor(255, 0, 0, 255), 10) dxDrawLine3D(x, y, z, x - sinz * maxy, y + cosz * maxy, z, tocolor(0, 255, 0, 255), 10) dxDrawLine3D(x - sinz * maxy, y + cosz * maxy - 0.05, z, x - sinz * maxy + sinz * 0.3, y + cosz * maxy - cosz * 0.3, z - 0.25, tocolor(0, 255, 0, 255), 10) dxDrawLine3D(x - sinz * maxy, y + cosz * maxy - 0.05, z, x - sinz * maxy + sinz * 0.3, y + cosz * maxy - cosz * 0.3, z + 0.25, tocolor(0, 255, 0, 255), 10) end Edited February 27, 2015 by Guest Link to comment

Addlibs Posted February 26, 2015 Share Posted February 26, 2015 Erm - as far as I know rotation (180, 0, 180) is the same as (0, 180, 0). When an object is facing North, X rotation is pitch (nose up/down), Y rotation is the roll, and Z is the yaw. X=180 makes an object go up-side-down facing South, and Z=180 turns it again North Y=180 makes the object roll up-side-down still facing North. Same thing? Link to comment

koeno100 Posted February 26, 2015 Author Share Posted February 26, 2015 Erm - as far as I know rotation (180, 0, 180) is the same as (0, 180, 0).When an object is facing North, X rotation is pitch (nose up/down), Y rotation is the roll, and Z is the yaw. X=180 makes an object go up-side-down facing South, and Z=180 turns it again North Y=180 makes the object roll up-side-down still facing North. Same thing? I know that it's the same thing, but in radians it isn't. y = 180 degrees flips over the whole y axis Link to comment

Addlibs Posted February 26, 2015 Share Posted February 26, 2015 I don't really get what you mean by 'flips over the whole y-axis' Link to comment

koeno100 Posted February 26, 2015 Author Share Posted February 26, 2015 If rz = 0, then the y-axis is positive, but if rz = 180, then the y-axis is negative For example: The rz = 0, then the y-axis is 1, if rz = 0, then you've passed half of the circle, so your y-axis is -1. Get it? Link to comment

Reyomin Posted February 26, 2015 Share Posted February 26, 2015 If you rotate an object 180 degrees around X axis and then 180 degrees around Z axis, you get the same result which you do by rotating the object 180 degrees around Y axis. Whether it's in degrees or radians, it's still the same. Link to comment

koeno100 Posted February 26, 2015 Author Share Posted February 26, 2015 If you rotate an object 180 degrees around X axis and then 180 degrees around Z axis, you get the same result which you do by rotating the object 180 degrees around Y axis. Whether it's in degrees or radians, it's still the same. Yes, but not in radians Link to comment

koeno100 Posted February 26, 2015 Author Share Posted February 26, 2015 This is what I mean with the y-axis flipping over: https://www.dropbox.com/s/d7ikx0lh9t3do ... d.mp4?dl=0 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 account## Sign in

Already have an account? Sign in here.

Sign In Now