Reader small image

You're reading from  Unity for Architectural Visualization

Product typeBook
Published inSep 2013
Reading LevelIntermediate
PublisherPackt
ISBN-139781783559060
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Stefan Boeykens
Stefan Boeykens
author image
Stefan Boeykens

Stefan Boeykens is a Belgian architect-engineer. Starting out as a professional architect in several offices, he returned to KU Leuven in 2000, at the Department of Architecture, for teaching and research, completing his PhD on Building Information Modelling in 2007. Stefan is an experienced researcher with a variety of IT skills. Aside from teaching BIM, he is mainly working as senior Innovation and BIM manager for the Belgian D-Studio, focusing on BIM middleware and consultancy. He is a frequent speaker at BIM-related events and is actively involved in BIM standardization groups, including CEN/TC 442 (Europe) and Belgian Technical Committees. He is father of three boys and enjoys musical composition, reading, cycling and life-long-learning.
Read more about Stefan Boeykens

Right arrow

Further interactions


We finish this chapter with some more useful techniques.

Resetting the player

What if, at one point, the user reaches the edge of the terrain or world you created and falls off? Instead of expecting the user to quit and restart, you should solve the problem elegantly. We place a large, invisible plane underneath our world, as a trigger to reset the player.

  1. Add a Plane GameObject and set its Mesh Collider to Is Trigger. Make it large enough to extend to all sides of the scene and move it down underneath all other objects, as in the setup in the next screenshot.

  2. Disable its Mesh Renderer, to make it invisible.

  3. Create a new C# script called resetPlayer and add the following code. It takes three private variables: one for the player's position (pos), one for its rotation (rot), and then the actual reference to the player (thePlayer). This is shown in the following code:

    using UnityEngine;
    using System.Collections;
    public class resetPlayer : MonoBehaviour {
      private Vector3 pos...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Unity for Architectural Visualization
Published in: Sep 2013Publisher: PacktISBN-13: 9781783559060

Author (1)

author image
Stefan Boeykens

Stefan Boeykens is a Belgian architect-engineer. Starting out as a professional architect in several offices, he returned to KU Leuven in 2000, at the Department of Architecture, for teaching and research, completing his PhD on Building Information Modelling in 2007. Stefan is an experienced researcher with a variety of IT skills. Aside from teaching BIM, he is mainly working as senior Innovation and BIM manager for the Belgian D-Studio, focusing on BIM middleware and consultancy. He is a frequent speaker at BIM-related events and is actively involved in BIM standardization groups, including CEN/TC 442 (Europe) and Belgian Technical Committees. He is father of three boys and enjoys musical composition, reading, cycling and life-long-learning.
Read more about Stefan Boeykens