|
Post by Red Moon Entertainment on Feb 12, 2017 14:08:25 GMT
I'm trying to make a lighthouse with a spot-type light which neverending rotate. It rotates horizontaly, changing X-axe value. Does anyone know a script (or another way) to make something like this?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Feb 12, 2017 15:48:56 GMT
Link: Unity Tutorial | Spinning CubeThis is a tutorial on how to make an object spin. It contains some code, but I'm unsure if it's obsolete or not. I also am unsure if this would work with just light, so I recommend placing an invisible mesh with the script, and attaching the light to the object. ___________________________________ C# is displayed down there. On the site, there is more languages for this.
___________________________________ using UnityEngine; using System.Collections; public class Spin : MonoBehaviour { public float speed = 10f; void Update () { transform.Rotate(Vector3.up, speed * Time.deltaTime); } }
|
|
|
Post by Red Moon Entertainment on Feb 12, 2017 18:29:00 GMT
I tried adding it as a child of the invisible object but this message appears: What to do?
|
|
|
Post by Red Moon Entertainment on Feb 12, 2017 18:42:12 GMT
Solved using Java.
I noticed that this type of scripts (which make rotate something) work in a strange way with child objects. They translate them too. However, I think the problem's solved.
Thanks @lolwhatevr13
|
|