Thanks for that Li.

I've put together a convenient method snippet based on your idea for
anyone else wanting a quick hit area implementation:

http://pastie.org/674858

Maybe this could be added to Away3D as textField3D.add2DHitArea() or
similar.




On Oct 28, 7:19 pm, Li <[email protected]> wrote:
> Hey Philip,
>
> For this, I usually I sweep the the vertices in the text mesh and find min
> and max values and with this get the boundaries for a box.
> The box can be drawn in a new face:
>
> var box:Face = new Face();
> box.moveTo(topLeft.x, topLeft.y, 0);
> box.lineTo(topRight.x, topRight.y, 0);
> box.lineTo(bottomRight.x, bottomRight.y, 0);
> box.lineTo(bottomLeft.x, bottomLeft.y, 0);
> box.lineTo(topLeft.x, topLeft.y, 0);
> box.material = someColorMaterialWithAlmostZeroAlpha;
> textMesh.addFace(box);
>
> Hence the box acts as a hit. Its not visible, but it captures mouse clicks
> around the text. You can also use inflate() on the rectangle you calculate
> for the text bounds if you want to make your hit bigger.

Reply via email to