Sie sind nicht angemeldet.

1

Montag, 9. Oktober 2023, 06:22

How to obtain the 3D position (tx, ty, tz) of mouse clicks in a 3D model

I want to obtain the location of mouse clicks in 3D space and do something similar to adding hotspot


I saw this example on the official website:


https://krpano.com/releases/1.21/viewer/…xtured/test.xml


3D Measurements - between two points - can add hotspots to 3D models

But I don't know how to retrieve 3D coordinates through custom events. Can anyone tell me what to do ?

2

Dienstag, 10. Oktober 2023, 10:19

Hi,

use the screentodepth() and/or raycastdepth() actions:
https://krpano.com/docu/actions/?version=121#screentodepth
https://krpano.com/docu/actions/?version=121#raycastdepth

The depthmap_measure3d.xml is also just doing this:
https://krpano.com/viewsource.html?relea…p_measure3d.xml

E.g. (Javascript code):

Quellcode

1
2
3
4
5
var hit = krpano.actions.screentodepth(krpano.mouse.x, krpano.mouse.y);
if (hit)
{
  ...
}


Best regards,
Klaus

3

Mittwoch, 11. Oktober 2023, 09:05

It's working.
Thank you, Klaus.