Advertisement
selzero

Controlling Game Items Script 2

Sep 22nd, 2012
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class RemoteCubePosition : MonoBehaviour {
  5.     public GameObject goTheCube;
  6.     CubePosition cpTheScriptOnTheCube;
  7.  
  8.     void Start ()
  9.     {
  10.         //Get the CubePosition script from the cube object
  11.         cpTheScriptOnTheCube = goTheCube.GetComponent();
  12.     }
  13.  
  14.     // Update is called once per frame
  15.     void Update () {
  16.         //Set the global variables to this objects coordinates with an offset of 3
  17.         cpTheScriptOnTheCube.fX = gameObject.transform.position.x-3;
  18.         cpTheScriptOnTheCube.fY = gameObject.transform.position.y-3;
  19.         cpTheScriptOnTheCube.fZ = gameObject.transform.position.z-3;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement