Skybox 2d 3d translation

Software: Away3D 4.x

Grillip, Newbie
Posted: 22 November 2013 11:34 AM   Total Posts: 2

Hi,

thanks for a great engine!
I’ve just started using it today.

Here’s my first question:

I have a skybox with textures of 1024x1024
On one of the textures there is a point at 2D coordinate of say 100,100 that I am interested in. How would I go about and retrieve this point in 3d (world?) coordinates?

Any help or directions would be much appreciated.

   

Avatar
Fabrice Closier, Administrator
Posted: 22 November 2013 05:24 PM   Total Posts: 1265   [ # 1 ]

A skybox has no radius. It’s always behind no matter what.
You do not need it for this. Just calculate the coordinates of your 2d map to spherical, as the skybox is always at 0,0,0, you will just need to define some radius, transform using camera transform and view.unproject this 3d vector.

   

Grillip, Newbie
Posted: 22 November 2013 06:47 PM   Total Posts: 2   [ # 2 ]

Thank you for your answer.

I figured that I could just map the 2d coordinates and multiply it with the camera view distance e.g.

if the texture coordinate is on the negative z side, this is what I do:

x = (min2 + (max2 - min2) * ( (value2dx - min1) / (max1 - min1) )) * -distance
y = (min2 + (max2 - min2) * ( (value2dy - min1) / (max1 - min1) )) * -distance
z = -distance

where min1 = 0, max1 = texturewidth, min2 = -1, max2 = 1

I realize that this is not answer to my original question, but it served the purpose. smile

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X