wiki.sine.space | sinespace

Making Animated Doors

From wiki.sine.space
Revision as of 19:55, 11 October 2016 by JamesStallings (Talk | contribs) (The Sliding Door)

Jump to: navigation, search


In this Tutorial we will illustrate the construction and configuration of three scripted doors: the Sliding Door, the Double Sliding Door and the Swinging Door. Both doors are presently a bit simple. We'll be updating both the doors themselves and the wiki as needed.

Doors could be said to be complex game objects. They are structured collections of GameObjects and Components, and how they are assembled and "wired up" is essential to their operation. They will typically consist of some sort of framing in which the door proper and possibly a hinge sits, and the door, which may be a single mesh or in the case of the swinging door, an empty GameObject "hinge" to which the door mesh is a child.

Additionally, the various GameObjects will have certain components associated with them, typically to facilitate user interaction and to animate the GameObject.

Setting up doors can be a bit tricky, but creating content for unity is not for the faint of heart. Hopefully, with this tutorial we can make that workflow somewhat less painful for Space creators.


The Sliding Door

The Single Panel Sliding Door is perhaps the simplest possible articulated door. Before we get into a step-by-step walkthrough of it's construction, lets break it down conceptually from the top level.

Firstly, there are three requirements of any door:

  • it must be somehow attached or stationary relative to some enclosure
  • it must provide ingress to the enclosure to which it is thusly attached
  • similarly, it must provide egress from the enclosure to which it is attached

Given these requirements, we could say that we will need a structure for the door frame, of arbitrary complexity, and a structure for the door proper, of equally arbitrary complexity.

For this door, our doorframe will be fairly complex, consisting of a transom piece, a threshold piece, and left and right door posts. The door will be a single cube mesh of appropriate size and proportions to fit suitably within the frame.

To get started, create a new project for space, or perhaps use one that you have available for experimentation and development. Use the ==Main Menu== to create the first of the cubes we'll use (==Main Menu: GameObject->3D Object->Cube==). Just under the left side of the main menu, click the button to expose the scaling tools. Scale the cube a bit higher than the head of the avatar you would use to walk through the door, and then a little wider than that avatar; on the remaining axis, make it proportionately thick.

Space-1-panel-sliding-door-tutorial-01.png

Next duplicate this cube. Be sure it is selected, as in the image above, then in the hierarchy, ==right click->Duplicate. Now switch to the translation tool, and move the copy along the X axis until it is clear of the door. Switch back to the scaling tool, and edit the thickness in each horizontal direction to form the left door post. Duplicate this one just as you did the door previously, and using the translate tool, move it to the right of the door.

Perform similar operations for one each of a transom (above the door) and a threshold (below the door). It should look something similar to the image below: Space-1-panel-sliding-door-tutorial-02.png

Double Sliding Door

The Swinging Door