Jump to content

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


dzek (varez)

Recommended Posts

Posted

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 
  

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

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

?

Posted

hell, i though you replied :(

i was thinking about attaching an object (like invisible corona) to car - and get pos of corona - much simpler, as the offset X, Y, Z while attaching are including source rotation.

but i would like more to make it via pure scripting.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

i know about this, lol :/

i'm not the guy that can't check the wiki before asking.

this function about is for something totally different, and it's returning X and Y only too.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

i'll try all these solutions when i'll find some free time, thanks, ill post the result

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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...