[Papervision3D] Mouse events with transparent BitmapFileMaterial
Steven de la Torre | BLITZ
SdelaTorre at blitzagency.com
Wed Jun 20 14:40:00 EDT 2007
Dude... so this might sound like a filty hack... yes actually it is... but how bout this:
Make a second entirely invisible shape that is the same shape as the opaque part of your .png and then make that hot.
Of course if you have a million different images to perform this on, that wont work... but if you just want a couple things to be hot like that, I say invisible meshes that are hot is the way to go.
dela
-----Original Message-----
From: Papervision3D-bounces at osflash.org [mailto:Papervision3D-bounces at osflash.org] On Behalf Of Cay
Sent: Wednesday, June 20, 2007 4:45 AM
To: Papervision3D at osflash.org
Subject: Re: [Papervision3D] Mouse events with transparent BitmapFileMaterial
Specially if it is a rollOver event...
You could save a few calculations using mouse events, and when they
fail (pixel is transparent) you do the whole calc. Still, it sounds
pretty hardcore ^^
On 6/20/07, ricardo cabello ! mr.doob <info at mrdoob.com> wrote:
> True, I didn't though about that... Cay you always going an step ahead
> ;) I guess you could implement a code for each poly that gets rendered
> to check the screenX and screenY of each vertex, then get the area of
> the poligon and check if the mouse is in the area, in that way you can
> do arrays of polys that are under the cursor.
>
> Sounds hard to do and maybe slow to calculate...
>
> On 6/20/07, Cay <ventdaval at gmail.com> wrote:
> > Plus, after detecting its a transparent pixel, you would have to
> > detect which object is behind it... And since it wouldn't capture the
> > mouse event, it could be rather difficult...
> > Maybe if you don't use mouse events at all, and stick to some
> > hitTest-like algorithm...
> >
> > On 6/20/07, ricardo cabello ! mr.doob <info at mrdoob.com> wrote:
> > > I believe that's way complicated :( As to do want, when the user
> > > clicks on the textured object, will have to find out which pixel of
> > > the texture you're clicking in and check the alpha. In fact, maybe you
> > > can do that with away3D, as they already have a click2UVmap feature
> > > implemente I think.
> > >
> > > On 6/20/07, gilemon <gilemon at free.fr> wrote:
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Hi,
> > > >
> > > > I'm using the BitmapFileMaterial and then I use the container to register my
> > > > mouse event.
> > > >
> > > >
> > > >
> > > > Ø materials[num] = new BitmapFileMaterial(path);
> > > >
> > > > Ø var plane :Plane = new Plane( materials[num], paperSize, 0, 2, 2 );
> > > >
> > > > Ø ....
> > > >
> > > > Ø var container:Sprite = plane.container;
> > > >
> > > > Ø container.buttonMode = true;
> > > >
> > > > Ø container.addEventListener( MouseEvent.ROLL_OVER, doRollOver );
> > > >
> > > >
> > > >
> > > > I'm loading some transparent png and gif.
> > > >
> > > > Everything works great! But...
> > > >
> > > >
> > > >
> > > > But I'm struggling to find a way to make the MouseEvent.ROLL_OVER event
> > > > DISABLED when the mouse is over the TRANSPARENT area of the loaded file.
> > > >
> > > >
> > > >
> > > > I'd like to be able to click a sprite which is visible but below another
> > > > one.
> > > >
> > > >
> > > >
> > > > Is there any Boolean flag I missed somewhere or is it something more
> > > > complicated?
> > > >
> > > >
> > > >
> > > > Thanks,
> > > >
> > > >
> > > >
> > > > G
> > > >
> > > >
> > > > _______________________________________________
> > > > Papervision3D mailing list
> > > > Papervision3D at osflash.org
> > > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Ricardo Cabello ~ Mr.doob
> > > Designer + Developer
> > >
> > > Web: http://mrdoob.com
> > > RSS feed: http://mrdoob.com/rss.php
> > > MSN/AIM: info at mrdoob.com
> > >
> > > _______________________________________________
> > > Papervision3D mailing list
> > > Papervision3D at osflash.org
> > > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> > >
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
>
>
> --
> Ricardo Cabello ~ Mr.doob
> Designer + Developer
>
> Web: http://mrdoob.com
> RSS feed: http://mrdoob.com/rss.php
> MSN/AIM: info at mrdoob.com
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>
_______________________________________________
Papervision3D mailing list
Papervision3D at osflash.org
http://osflash.org/mailman/listinfo/papervision3d_osflash.org
More information about the Papervision3D
mailing list