/* Copyright 2013, Aleksander Hristov, boxcollider@gmail.com . This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ using UnityEngine; using System.Collections; //Class responsible for rotating an object along Y world axys. //Attach this script to an empty game object in scene. public class GameObjectRotator : MonoBehaviour { Transform myTransform; public float rotationSpeed=10f; void Start () { myTransform=transform; } void Update () { myTransform.Rotate(Vector3.up*rotationSpeed*Time.deltaTime,Space.World); } void OnBecameVisible() { enabled = true; } void OnBecameInvisible() { enabled = false; } }
Thursday, October 31, 2013
UNITY3D rotate object script
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment