Virtools高级教程—Proximity 接近 - Virtools
Proximity
Instruction:
本范例说明当Jane接近Statue于一定的距离时,Statue便面向着Jane;但当Jane移动且与Statue超过预定的距离时,Statue便恢复自转。
Building Blocks:
(a) Character Controller-Characters/Movement/Character Controller
(b) Keyboard Controller-Controllers/Keyboard/Keyboard Controller
(c) Character Keep Floor Limits-Characters/Constraint/Character Keep Floor Limits
(d) Proximity-Logics/Test/Proximity
(e) Rotate-Transformations/Basic/Rotate
(f) Look At-3D Transformations/Constraint/Look At
(g) Text Display-Interface/Text/Text Display
(h) Set As Active Camera-Cameras/Montage/Set As Active Camera
制作构想:
首先必须利用Building Blocks-Character Controller、Keyboard Controller设定键盘控制Jane的动作;再利用Character Keep On Floor Limits设定Jane与地面接触属性。
此外,可以用Building Blocks-Proximity控制Jane和Statue间的距离以便间接控制Statue是自转或是观看着(Building Blocks-Look At)Jane。
制作步骤:
(a) Jane
Character Controller:设定Jane的Animations。
首先从Virtools Resources/Characters/Animations/Skin Character Animation/Jane里点选Wait.cmo、Walk.cmo以及WalkBckwd.cmo并拖曳至Jane,再设定Stand Animation、Walk Animation以及Backward Walk Animation。
Keyboard Controller:设定Jane可以经由键盘来操控动作,内定值为Wait-None、Walk-Key 8、Turn Left-Key 4、Turn Right-Key 6、Backward Walk-Key 2。
Character Keep On Floor Limits:Jane会保持站立于地面,且在Floor的边界会有仿真的围墙,使Jane无法超越Floor的边界。
首先于Level Manager/Default Level/Global/3D Objects / Plane / Add Attribute / Floor Manager/Floor增加保持与地面接触的属性,再于Building Blocks-Character Keep On Floor Limits作循环即可(如图标)。
(b) Statue
Proximity:设定两物体间的距离Distance-3;设定ObjectA、ObjectB为Jane与Statue;Barycenter不勾选表示两物体间的距离是由轴心起算,且由pOut输出两物体目前的距离Current Distance。
Convert:由浮点数(Float)转换为整数(Integer)。
Text Display:首先于Text Display/Construct/Add Parameter Input设定Parameter Type-Integer。设定偏移值Offset(X, Y);文字颜色Color(R, G, B, A);对齐方式Align;字体大小Size;文字内容Text,且由pIn输入变量距离值Pin 5(Integer)。
Rotate:设定旋转轴Axis of Rotation-Y轴(0, 1, 0);设定旋转角度值Angle of Rotation(Turn:圈数、Degree:角度);设定Referential of the Axis- -NULL-;勾选Hierarchy表示Building Blocks也同样应用在Child(如图标)。