Jump to content

How to get camera look position


Guest Smacenis

Recommended Posts

Hi.

I gotta a problem, when trying to set up a CDM map.

When the CDM map loads, there is spawn screen, with camera looking at the spawn base. I have made my own spawns, but i have no idea, how to got the coordinates for camera view.

Here is camera code what i need to fill with my position:

<camera lookX="coordinates what i need goes here" lookY="coordinates what i need goes here" lookZ="coordinates what i need goes here"  

So how do i get these coordinates?

Link to comment

when the map is loaded this should do the trick:

function getPos () 
    cams  = getElementsByType ("camera") 
    for k, v in ipairs (cams) do 
        outputChatBox ("X: "..getElementData(v, "posX").." Y: "..getElementData (v, "posY").." Z: "..getElementData (v, "posZ")) 
    end 
end 
  
addCommandHandler ("getCamPos", getPos()) 

Please note that this is untested so there might be typos in it ;)

Link to comment

hmm, it outputs for me:

  
X: 1817.2817382813 Y: -1888.9372558594 Z: 23.448707580566  
X: 397.38107299805 Y: -1520.8565673828 Z: 53.859817504883 
X: 2173.7333984375 Y: -1015.2341308594 Z: 73.123916625977  
X: 634.07379150391 Y: -1889.27734375 Z: 1889.27734375 

And if i change my camera look position, the numbers still are the same...

Link to comment
  • 1 year later...

a bit hacky but works

add stealth's definitions in the editor, move the camera in the editor like you want it to be in th end, open the map settings -> gamemode settings -> stealth -> camera -> get current -> ok, then save as, choose name and find the new maps meta.xml, the camera position + look at will be in the settings

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