Tutorial / Example - a Floor-hotspot at the Mouse-position

• Hi,

I have seen several times examples that try to make a 'floor-hotspot' that automatically moves with the mouse position - and often this seems to be done by using spherical coordinates and some tricky rotations, but that typically results in a not correct looking perspective of the hotspot.

Here a more correct and still very simple solution:

• The hotspot will be '3d-placed' by the tx,ty,tz coordinates (and not by the spherical ath/atv/depth coordinates) and will be defined to be always be parallel-rotated to the floor.
• A custom 'floor-height' will be manually defined. That can be individual for each pano and would be the height of the camera when shooting the pano.
• Then to get the 3d position for the floor hotspot:
• First get the spherical position at the mouse position using the screentosphere action.
• Then convert that spherical position to a 3d unit/direction vector using the spheretospace action with depth=1.
• Then scale that vector to hit the floor - simply by scaling the unit-vector by the factor 'floorheight/unit-vector-y'.

Here as code:

Code
``````set(floorheight, 160);
screentosphere(mouse.x,mouse.y, h,v);
set(d,1);
spheretospace(h,v,d, x,y,z);
calc(hotspot[name].tx, x*floorheight/y);
calc(hotspot[name].tz, z*floorheight/y);
copy(hotspot[name].ty, floorheight);``````

This are only a few code-lines and will result it a correctly placed hotspot in 3d space and will look good from all viewing angles.

Additionally having the correct 3d position allows doing other nice things,

• e.g. automatically rotating the hotspot into the target direction,
• changing the alpha depending on the distance,
• or even moving toward the point in 3d-space, but that one would be only useful for depthmapped panos.

Here a full example:
https://krpano.com/releases/1.20.…mouse-position/

And here the example source:
https://krpano.com/viewsource.htm…pot-example.xml

Best regards,
Klaus

• Thank you Klaus, this is awesome, any chance to get the multiple texture support for Obj files too, please?
Regards.

• Hi,

i was playing a bit and have a question.

I like the floor hotspot to point (rotate) to the ath position of the center of the/a polygonal hotspot.
I tried quite some, getcenter stuff etc..
No..succes..
perhaps i made a stupid mistake (obviously).. or just am/was on the wrong path.

Tuur

• Could it be possible to go one step further, such as showing up on surfaces with depth information?

Not yet, but with one of the next releases.

• Not yet, but with one of the next releases.

That's great.I'm looking forward to it.

In addition, if the virtual scene panorama is rendered through the model, theoretically there is no need to draw the additional model, because it carries depth and camera information.Is it possible to develop a tool that generates model files directly from 3DMax or Blender without relying on EverPano?This saves a lot of tedious and repetitive work.

• Not yet, but with one of the next releases.

Hello Sir,

It is not yet possible right? or no update yet?

Thanks for the response.

Images

• Excellent
It is possible to walk on floor in 360 photo whit this example?

• TOP!! Thanks Klaus!!
DP

Danavon

• hi klaus,

if you combine this with the dollhouse example and http://view.ox/y/z gets set,
the hotspot doesn't move in sync with the mouse anymore
would you have a tip here?

best, index

edit... the documentation says about http://view.ox/y/z :
" An additional 3D translation offset of the viewpoint.
But the viewing rotation will be still from the non-offset point.
"
so to find the effective/true position in 3d space we would need to
rotate the http://view.ox/y/z vector by hlookat/vlookat and add this vector to http://view.tx/y/z ?

• here a small sampler showing the problem
the view offset (oz) is not taken in account

• Hi,

just as quick note - in version 1.20.11 support for dollhouse views was added.
The links in the first post were updated accordingly.

Best regards,
Klaus

• Hi Klaus
Is it possible to override or limit the action of the floor hotspot
when approaching the edge of the panorama and thus prevent the
panorama from disappearing when the last wall is clicked?
and the panorama does not disappear?
Ramiro

• How to see Floor-hotspot at the Mouse-position on a mobile?

onover="set(hotspot[floorspot].visible, false);"
onout="set(hotspot[floorspot].visible, true);"

does not work on mobiles, any other option?

don't walk through walls:

https://dearte.online/nav/

• Hi Klaus
Is it possible to override or limit the action of the floor hotspot
when approaching the edge of the panorama and thus prevent the
panorama from disappearing when the last wall is clicked?
and the panorama does not disappear?
Ramiro

https://dearte.online/nav/

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!