RESOLVED!
I'm trying to get the distance to the model (wall, floor, ceiling) along a line from viewpoint to hotspot.
I made a test, next to the mouse cursor, the distance to the model is shown at the location of the screentodepth ( mouse.x, mouse.y, hit);
I placed the hotspots further than the model and when clicking on the hotspot, the distance to the partitions on the hotspot should be displayed (on the line from the viewpoint to the hotspot)
raycastdepth(view.tx, view.ty, view.tz, caller.tx, caller.ty, caller.tz, hit);
when view.tx, view.ty, view.tz are zero, then the distances are the same, but if I start moving, then when I click on the hotspots, other numbers are displayed.
What could be wrong?
Here is an example and code
Code
<layer name="inf_l" type="text" keep="true" edge="bottom" oy="-20" enabled="false" bgalpha="0.3"
onloaded="show_distance(); delayedcall(0.01, onloaded());" />
<action name="show_distance" scope="local" >
screentodepth( mouse.x, mouse.y, hit);
copy(caller.x, mouse.x);
copy(caller.y, mouse.y);
calc(caller.html, 'mouse hit.d=' + roundval(hit.d, 1));
</action>
<style name="hs" type="text" keep="true" distorted="false" depth="0" depthbuffer="false" rotationorder="zxy"
bg="true" padding="2 5 2 5" html="hs" onclick="show_distance2()" />
<hotspot name="hs1" style="hs" tx="-100" ty="300" tz="300" />
<hotspot name="hs2" style="hs" tx="-300" ty="0" tz="200" />
<action name="show_distance2" scope="local" >
raycastdepth(view.tx, view.ty, view.tz, caller.tx, caller.ty, caller.tz, hit );
calc(caller.html,'hit.d='+ roundval(hit.d, 1));
trace(caller.html);
</action>
Alles anzeigen