21
Wheel (Shape) [VR Car in the Mountains]
Tree1 (Group) [VR Car in the Mountains]
Wood (Group) [VR Car in the Mountains]
Canal (Shape) [VR Car in the Mountains]
ElevApp (Appearance) [VR Car in the Mountains]
River (Shape) [VR Car in the Mountains]
Bridge (Shape) [VR Car in the Mountains]
Road (Shape) [VR Car in the Mountains]
Tunnel (Transform) [VR Car in the Mountains]
V našem virtuálním světe je celá řada pojmenovaných uzlů, my bychom rádi
animovali polohu auta – uzlu Automobile. Tento uzel je typu Transform – jeho
polohu tedy můžeme nastavit změnou hodnoty jeho pole translation.
(Počáteční polohu auta zjistíme například tak, že stiskneme F5 – zobrazíme si
drátěný model virtuálního světa – auto se skrývá v tunelu nalevo.)
K polím tohoto uzlu můžeme přistupovat dvojím způsobem – buď s použitím
tečkové notace, anebo tak, že získáme handle k jeho objektu vrnode a
použijeme metod tohoto objektu:
Tečková notace:
pos = wh.Automobile.translation
3.0000 0.2500 0
Vytvoření objektu vrnode:
nh = wh.Automobile;
pos = nh.translation
<nebo také>
pos = getfield(nh, ‘translation’)
3.0000 0.2500 0
Nyní nastavme novou polohu auta. Můžeme to udělat hned třemi způsoby:
nh.translation = [3 0.25 10];
wh.Automobile.translation = [3 0.25 10];
setfield(nh, ‘translation’, [3 0.25 10]);
Commenti su questo manuale