Hi,
I'm writing custom function attachElementsEx (alternative for attachElements https://wiki.multitheftauto.com/wiki/AttachElements).
function attachElementsEx( theElement, theAttachToElement, ox, oy, oz, orx, ory, orz )
... -- here I saving offsets etc.
end
addEventHandler( "onClientRender", getRootElement(),
function()
... -- here I calculating and updating positions and rotations of attached elements
end
)
While I'm calculating end point XYZ (including rotation), I have the following variables:
local px,py,pz = getElementPosition( theElement ) -- position XYZ of source element
local rx,ry,rz = getElementPosition( theElement ) -- rotation XYZ of source element
local ox,oy,oz -- position offsets
local orx,ory,orz -- rotation offsets
From this data i have to calculate end position (and rotation) of attached element, but i don't know how to do it. I know how to make same script in 2D dimension, but 3D it's too hard for me.
THX for help