There’s no special function for that. The calculations are quite straight-forward: when you click somewhere in the scene, the code obtains the current mouse/touch coordinates and casts a ray from that point inside the scene to check if there’s any intersections with the scene’s objects.
This scheme works most of the time, but in some unusual cases related to canvas positioning, offsets or css 2d/3d transformations there can be issues with obtaining mouse/touch coordinates.
I can reproduce the behavior similar to what you described here only if I rotate the canvas element via css transforms (e.g. transform: rotate(45deg);
) and it happens only on mobile.
It can look like this:
– the clickable area in such case can be a bit wider than it should be, i.e. misplaced or stretched.
So, your issue may be a bug or may happen due to some tricky case that we just didn’t bother to support when we implemented this feature.
Attachments:
You must be
logged in to view attached files.
Co-founder and lead developer at Soft8Soft.