How to get the text with raycaster by clicking free spots on text


Hello people, I need to get the text by clicking on the text free spots, currently I can get the text on my scene but directly clicking on the text is there any wrapper for the text so I can detect the text by clicking on its free spots.

P.S. Thank You.

You mean that you do raycasting on this 3D text, and you want to raycast on a larger area than the text ? A simple way to do this is to add a box mesh with the size you want to the group containing the text, you set its visibility to false, and you raycast with this instead of the text.

1 Like

Or use an invisible plane mesh, if you’ve got flat text shapes.

1 Like

I was thinking about that options but I thought maybe there are other ways that I don’t know :slight_smile:

Thank you Very Much

But what about Three.js Box3 it can’t be useful here (I did some research) ?

Box3 is a mathematical object, which can indeed be useful here. You get a Box3 when you call geometry.computeBoundingBox(). I guess you can add a new BoxBufferGeometry with dimensions and offset matching the bounding box of the text geometry (if single), and make an invisible mesh of it, with a transform matching that of the text?