Not limiting walking through walls, but for loading scenes relative to „camera“ position, for example in a small room with 3 scenes (left, middle, right) on the same level (ty = floor level = always the same), you could just add a helper event and adjust the tz-"limits" working with your room (and even add more conditions with tx if needed) like this:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
<events onviewchange="adjust_scene_in_3d();" />
<action name="adjust_scene_in_3d">
if(view.tx != last_view_tx OR view.tz != last_view_tz,
copy(last_view_tx, view.tx);
copy(last_view_tz, view.tz);
if(scene[get(xml.scene)].name != 'scene1' AND get(view.tz) GE -250 AND get(view.tz) LE 250,
loadscene(scene1, null, MERGE|KEEPVIEW|KEEPMOVING|KEEPLOOKAT|KEEP3D, BLEND(0.01));
);
if(scene[get(xml.scene)].name != 'scene2' AND get(view.tz) LT -250,
loadscene(scene2, null, MERGE|KEEPVIEW|KEEPMOVING|KEEPLOOKAT|KEEP3D, BLEND(0.01));
);
if(scene[get(xml.scene)].name != 'scene3' AND get(view.tz) GT 250,
loadscene(scene3, null, MERGE|KEEPVIEW|KEEPMOVING|KEEPLOOKAT|KEEP3D, BLEND(0.01));
);
);
</action>
|
For easy limit finding:
|
Quellcode
|
1
|
<events ondoubleclick="trace('tx: ', get(view.tx), ' ty: ',get(view.ty),' tz: ',get(view.tz));" />
|
Without the BLEND action you will notice some visual jumping, thats why I put 0.01. Probably there is better solutions, for me it works and I'm looking forward to 1.21