Jump to content

Cinema - problem x,y,z


Matevsz

Recommended Posts

  
function webBrowserRender() 
local x, y = 110.7, 1024.15 <--- Set to location you want, very right of screen I'm assuming. 
dxDrawMaterialLine3D(x, y, TopZ, x, y, BottomZ,webBrowser, 18.2, tocolor(255, 255, 255, 255), x, y+1, 19) 
end 
  

There is only X and Y position my screen has x, y, z, and where now enter a "z"?

Screen:

ngxdzd.png

Just add "z"?

  
function webBrowserRender() 
local x, y, z = 1069.2900390625, -1110.424804875, 1995 
dxDrawMaterialLine3D(x, y, z, TopZ, x, y, BottomZ,webBrowser, 18.2, tocolor(255, 255, 255, 255), x, y+1, z, 19) 
end 
  

And so I do not work.. :(

Link to comment

Or better yet, simply do this and it will be automatic;

function getPositionFromElementOffset(element, offX, offY, offZ) 
    local m = getElementMatrix(element) 
    local x = offX * m[1][1] + offY * m[2][1] + offZ * m[3][1] + m[4][1] 
    local y = offX * m[1][2] + offY * m[2][2] + offZ * m[3][2] + m[4][2] 
    local z = offX * m[1][3] + offY * m[2][3] + offZ * m[3][3] + m[4][3] 
    return x, y, z 
end 
  
function webBrowserRender() 
    -- This will fetch the top middle point of the drive-in screen (Remember to replace the INSERTSCREENELEMENTHERE variable with your object pointer) 
    local screenPosX, screenPosY, screenPosZ = getPositionFromElementOffset(INSERTSCREENELEMENTHERE, 0, 0.04, 10.6) 
    dxDrawMaterialLine3D(screenPosX, screenPosY, screenPosZ, screenPosX, screenPosY, screenPosZ-8.5, webBrowser, 18, tocolor(255, 255, 255, 255), screenPosX, screenPosY+1, screenPosZ) 
end 

This way you can put the screen object pretty much wherever you please as the position is relative to the object and not worldspace. You can also easily adapt this for more than 1 screen if you so desire.

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