Jump to content

getting X,Y,Z from object position and rotation.


dzek (varez)

Recommended Posts

hi, im looking for way to get a point like 10units before my car.

i get function do to this- but it ignores Z position.

i need to make it work with any rotation.

function:

  
function getPositionRelatedToVehicle(theVeh, val) 
    local xx, yy, zz = getElementPosition(theVeh) 
    local rx, ry, rot = getElementRotation(theVeh) 
    local lx = xx + math.sin (math.rad(-rot)) * val 
    local ly = yy + math.cos (math.rad(-rot)) * val 
    return lx,ly 
end 
  

Link to comment

i second that request. have the same issue in my "omg" resource (need to correctly attach an object to main object if main is rotated by any axis, currently only Z rotation is fine).

it's not that i have no idea how to do this, in fact i do. but all these matrix calculations, euler angles and other math stuff are making my brain hurt. and i'm not even a programmer, im a designer. :3

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...