Jump to content
Sign in to follow this  
james mckenzie-smith

Is there and equivalent of onMapSingleClick for 3D space?

Recommended Posts

What the title says, really. I find onMapSingleClick quite useful, but it would be nice to be able to do some things without going to the map screen. I know that it must be possible, as we see in the HC functions etc., but I am not sure how to do it! Does anyone have a clue if there is a 3D space equivalent?

Share this post


Link to post
Share on other sites

Dear James, yes there is ! There exists a function called *worldToScreen* which does what you may require. At the moment you call this function it will return to you the 2D coordinates of where you are looking in the 3D world. Imagine you are a soldier walking in the 3D world on Utes. Now you point with your gun to a place e.g. the big hangar at the airport or to a vehicle parked on the street. When you call this function, it will convert the x-y-z coordinates you are pointing at in the 3D world into a x-y coordinate on your screen. The top left corner of the screen has x=0 and y=0 and the bottom right has x=1 and Y=1. So the center of the screen would be x = 0.5 and y=0.5.

There is also a reverse function *screen to world*. If you pass the center of the screen to it (x=0.5 and y=0.5) it will return the coordinates x,y,z where you are actually pointing at in the 3D world.

I think you can use that, e.g. if you want to direct artillary fire to the place where you are looking at.

Did this help ?

Greetings !

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×