I'm having an issue retrieving 2D coordinates off of a mesh based on a
3D object's position on the mesh.

You can normally retrieve the 2D coordinates on the bitmap making up
the mesh by dividing the coordinates of the object by the mesh's X and
Y scale values (see extrusions/CollisionMap.as class).

However, if you look at the position on the mesh and compare it to the
raw bitmap, due to some deformations that happen to the mesh with
certain subdivision values, the objects that appear in the bitmap
don't line up with the 2D coordinates on the raw bitmap.  If you tweak
the subdivision values, the objects on the bitmap in the mesh move
around/get squashed/etc.

Example:

Create a bitmap with a circle in the center filled with the color red.

Create an elevation using a flat height map and use the bitmap for its
skin.

When rendered in 3D, you will see the red circle in the center of the
mesh.  If you move your mouse over it, you can translate the 3D
coordinates into 2D space and divide them by the mesh's X and Y scale
values to get the real coordinates on the raw bitmap.

What I'm seeing with subdivision values X = 200 and y = 200 is that my
point on the mesh doesn't correlate to the same point on the 2D bitmap
when I convert the 3D coordinates to 2D, taking into account the mesh
scale values.

Is there something else I need to do to account for the subdivision
values?

If I didn't want any deformation of the mesh, are there subdivision
values I can use such that 3D points on the mesh would exactly match
up with 2D points on the associated bitmap?

Thanks,
Ari

Reply via email to