Advertisement
Guest User

Untitled

a guest
May 29th, 2015
822
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. using UnityEditor;
  4.  
  5. public class TransformMacros : Editor {
  6.         [MenuItem("Macros/Snap Selection To Ground &#v")]
  7.         public static void SnapToGround() {
  8.                 foreach (Transform t in Selection.transforms) {
  9.                         RaycastHit rayhit;
  10.                         if (Physics.Raycast(t.position, Vector3.down, out rayhit)) {
  11.                                 t.position = rayhit.point;
  12.                         }
  13.                 }
  14.         }
  15.        
  16. }
  17.  
  18. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement