Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using UnityEditor;
- using System.Collections;
- using System.Collections.Generic;
- public class PlaceLightProbes {
- [MenuItem ("GameObject/Place Light Probes")]
- static void DoPlaceLightProbes () {
- Bounds bounds = new Bounds(Vector3.zero,Vector3.zero);
- foreach (Renderer r in GameObject.FindObjectsOfType(typeof(Renderer)))
- {
- if (GameObjectUtility.AreStaticEditorFlagsSet(r.gameObject, StaticEditorFlags.LightmapStatic))
- {
- bounds.Encapsulate(r.bounds);
- }
- }
- Debug.Log ("Lightprobe Area Bounds:"+bounds);
- LightProbeGroup probes = (LightProbeGroup)GameObject.FindObjectOfType(typeof(LightProbeGroup));
- List<Vector3> probePositions = new List<Vector3>();
- for (float x = bounds.min.x; x<bounds.max.x; x += 2)
- for (float z = bounds.min.z; z<bounds.max.z; z += 2)
- {
- probePositions.Add(new Vector3(x,0.3f,z));
- probePositions.Add(new Vector3(x,2.3f,z));
- }
- probes.probePositions = probePositions.ToArray();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment