I have a unique situation where I'd like to actually be able to simulate a click onto an object. For example, a UI provides a way to pick out a certain element inside of the scene via scene.getObjectByName(objectName, true)
and I'd like to be able to click
this object.
Obviously, I could expose the functionality of what the real click
would do, but in these situations, I need to actually drive a click on the screen via JavaScript (e.g. $canvas.trigger($.Event('click', { clientX: 10, clientY: 20 }))
).
What are the best techniques for doing this. I'd imagine I would have to convert the object's position to screen (X, Y)
and simply trigger a click at those coordinates? But this would require precise coordinates for a click and I'm not sure how to get that from a mesh.