Advertisement
selzero

Controlling Game Items Script 1

Sep 22nd, 2012
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. public class CubePosition : MonoBehaviour {
  4.     //X position of the object
  5.     public float fX=0.0f;//Y position of the object
  6.     public float fY=0.0f;//Z position of the object
  7.     public float fZ=0.0f;
  8.  
  9.     // Update is called once per frame
  10.     void Update () {
  11.         //Create a Vector3 object using the global coordinates
  12.         Vector3 v3NewPosition = new Vector3(){x = fX,y= fY, z=fZ };
  13.  
  14.         //Replace this objects transform.position property
  15.         //with the new Vector3 to change its position
  16.         gameObject.transform.position=v3NewPosition;
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement