Answer the question
In order to leave comments, you need to log in
Is it possible to make a certain function be called on a click on the mash?
There is a 3D model in canvas. Is it possible to make it so that by clicking on this 3D model or on the area in which it is located, a certain function is called?
Answer the question
In order to leave comments, you need to log in
You hang a click event on the entire canvas, get the cursor coordinates from the event, and under the given conditions, run the desired function.
You need to attach an event handler to this element:
function handler() {
... ваша функция
}
elem.addEventListener( "click" , handler);
Good guide to events!
https://developer.mozilla.org/ru/docs/Web/Events
Click https://developer.mozilla.org/en-US/docs/Web/API/E...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question