From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
m (Text replace - "</csharp>" to "</syntaxhighlight>")
m (Text replace - "<javascript>" to "<syntaxhighlight lang="javascript">")
Line 10: Line 10:
== Javascript - Teleporter.js ==
== Javascript - Teleporter.js ==
<syntaxhighlight lang="javascript">
var teleportTo : Transform;
var teleportTo : Transform;

Revision as of 20:48, 10 January 2012

This script works like the halo Teleporters, but you can shoot rockets in to it and it come out the other teleporter Have fun with it. BY Ryan Davis.

Simply add two objects to your scene. Place this script onto the object you wish to be the entrance teleporter (must have a collider attached). Then drag the object from the Hierarchy, which will be the exit, into the slot named "teleportTo" in the entrances inspector, and voila.

Javascript - Teleporter.js

var teleportTo : Transform;
function OnCollisionEnter (col : Collision) {
    col.transform.position = teleportTo.position;	
== CSharp - Teleporter.cs ==
<syntaxhighlight lang="csharp">
using UnityEngine;
public class Teleporter : MonoBehaviour
    Transform teleportTo;
    void OnCollisionEnter (col : Collision) {
        col.transform.position = teleportTo.position;	
Personal tools