Hi guys, I’m trying to set the position of my 3d Object on the screen to where the user clicked but as soon as i click somewhere my object just disappear here is my code:
threecanvas.onclick = myClickHandler;
function myClickHandler(event) {
var x=event.clientX;
var y=event.clientY;
var z=0;
model.position.set(x,y,z);
}
However, this approach might not be ideal for your use case since the object will be placed right before the camera’s near plane. Consider to setup your code similar to the following example but raycast against a THREE.Plane. It will represent there are where you will place your objects.