Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class CubePosition : MonoBehaviour {
- //X position of the object
- public float fX=0.0f;//Y position of the object
- public float fY=0.0f;//Z position of the object
- public float fZ=0.0f;
- // Update is called once per frame
- void Update () {
- //Create a Vector3 object using the global coordinates
- Vector3 v3NewPosition = new Vector3(){x = fX,y= fY, z=fZ };
- //Replace this objects transform.position property
- //with the new Vector3 to change its position
- gameObject.transform.position=v3NewPosition;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement