texture click event with click uv coordinates

Software: Away3D 4.x

carsten_cs, Newbie
Posted: 24 February 2012 10:25 AM   Total Posts: 3

Hello

I’m very new to away3D. And I want to know if there is an clickevent in away3D with a reference to the texture of an mesh with the uv-coordinates auf the texture, so that you could reference through the texture possible 2d displayobjects.

If you want to realize 3D webpages, I think there is always this problem of interaction, so that there should exist a solution.

What is the typical workflow for that?

Have someone experiences with things like that?

Thanks carsten

   

Avatar
Matse, Sr. Member
Posted: 24 February 2012 11:46 AM   Total Posts: 149   [ # 1 ]

Hi Carsten,

The MouseEvent3D already provides UV info, you just have to enable it on the clickable mesh with mesh.mouseDetails = true;

I don’t see a need for the event to reference the texture, that would be weird in my opinion : MouseEvent3D provides the clicked material, just get your texture from there if you need, am I missing something ?

Here is the MouseEvent3D doc just in case : http://away3d[dot]com/livedocs/away3d/4.0/away3d/events/MouseEvent3D.html

Replace [dot] with a dot… pleaaaaase admins do something about the false spam detection when linking to away3d[dot]com : I think I’ll end up creating a dedicated topic about this as I seem to speak in the void :D

   

carsten_cs, Newbie
Posted: 24 February 2012 01:04 PM   Total Posts: 3   [ # 2 ]

Thanks for the information.

I look it up in the reference and find the following explaination: ‘The uv coordinate inside the draw primitive where the event took place.’

What is the meaning of draw primitiv ?

I find a class PrimitiveBase, but I’m not shure, if draw primitiv are primitives meshes?? because this would mean, that only uv coordinates of primitives would be accessable?


I hope draw primitiv have got a more complex meaning concerning materials, like you wrote.
When I would have the uv coordinates of the mesh how would I get the uv coordinates of the bitmap, through the material.

sorry, I’m at the beginning.

   

Avatar
Matse, Sr. Member
Posted: 24 February 2012 01:21 PM   Total Posts: 149   [ # 3 ]

In my understanding, a draw primitive is anything that gets drawn on screen : a mesh, a Sprite3D…

A mesh created from Primitive geometry (Cube, Plane, Cone etc) is exactly the same as a mesh you import from file. Getting the clicked UVs will work with any mesh (as long as it has texture coordinates I guess, which should almost always be the case).

Typically UVs are numbers between 0 and 1. On the X axis 0 will be your bitmap’s left, 1 will be your bitmap’s right. Same on Y axis : 0 for the top of the bitmap, 1 for the bottom.

Converting the clicked UV to a point in your Bitmap is just a matter of multiplying U with your bitmap’s width -1 and V with your bitmap’s height -1.

Say you have a 256x256 bitmap, and the UV you get from a click on your mesh is Point(0.5, 0.5) it will correspond to Point(127, 127) in your Bitmap (or 128, 128 depending on the rounding)

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X