Game Development Reference
In-Depth Information
Why?
The first line of that function should be familiar by now. The second line is
where iTween becomes helpful. The RotateTo function allows us to define
(object to rotate, angle to rotate to, duration of rotation). The documentation
for iTween is at http://itween.pixelplacement.com/documentation.php .
There all the new functionalities are listed along with the specifications of
how to use them. There's a lot of customization possible with iTween (charts
of “hashable args”); however the basic functionality is outlined as shown in
Figure 13.10 . Generally following these format lists does the trick.
Figure 13.10 iTweens web site with the core functionality highlighted.
Do note that there aren't necessarily any examples so being aware of
what the arguments mean is important. In this case “Vector3 rotation”
must take the format Vector3(x,y,z). Similarly the duration of rotation
(float time) must be a float so it can have a decimal.
It sometimes takes just a bit to get used to some of this terminology, but
the more script you write, the more natural these sorts of specification
will find their way into the scripts.
Step 9: Save and return to Unity. Fix any syntax errors that pop up in the
console.
Step 10: Apply this script (HallwayDoorsTriggerScript) to Trigger-
BulkheadDoor1.
Step 11: Define the door to be affected. In the script, we declared a
public variable that will show up as “Door” that will appear empty.
This script and its variable are visible in the Inspector when
Trigger-BulkheadDoor1 is selected. To define Door, drag Hallway_Door_
Bulkhead_Group from the Hierarchy panel to the input field for Door
( Figure 13.11 ). For now, use the one that is in Hallway_BakedGroup/
Search WWH ::




Custom Search