0

Is it possible to get xyz position (probably not Z because it is forward and backward) when mouse click on a-scene?

for example:

<a-image id="image1" click-drag src="image/info.png" position="1 0.75 1" rotation="0 0 0"></a-image>

What i am trying to achieve is, when I click on the scene, i want put object in the scene, but I need to find out what is the exact position.

Please advise.

Fuji
  • 73
  • 2
  • 6
  • Possible duplicate of [How to find the coordinates of a raycaster intersection point on an object in a-frame?](https://stackoverflow.com/questions/40294039/how-to-find-the-coordinates-of-a-raycaster-intersection-point-on-an-object-in-a) – Don McCurdy Jun 08 '18 at 14:16
  • hi @DonMcCurdy, to find out the position of an object in a-scene is doable, this link didnt answer my question. i give an example, if i move the camera upward, but i want to find out, what is the coordinates i am currently looking at. – Fuji Jun 10 '18 at 11:42
  • That's what the answer does — listen for a `click` event, then log or check `evt.detail.intersection` for the coordinates. Use that to call `el.setAttribute('position', position)`. – Don McCurdy Jun 10 '18 at 19:00
  • that is not solving question. It is true if there is a object and the cursor hovered on it, then the coordinates can be obtained from evt.detail.intersection. – Fuji Jul 03 '18 at 06:10
  • Normally in aframe you use a cursor and mouse clicks emit `click` events on the object under the cursor. If you don't want to use a cursor, and just want to click with the mouse anywhere on screen, then you need a component like https://github.com/mayognaise/aframe-mouse-cursor-component. – Don McCurdy Jul 03 '18 at 16:07

0 Answers0