MoveGroup.cs 440 B

123456789101112131415161718192021222324
  1. //write by shadow
  2. using UnityEngine;
  3. using System.Collections;
  4. public class MoveGroup : MonoBehaviour {
  5. public Transform group;
  6. // Use this for initialization
  7. void Start () {
  8. }
  9. // Update is called once per frame
  10. void Update () {
  11. if(Input.GetMouseButtonDown(0)){
  12. Ray ray=Camera.main.ScreenPointToRay(Input.mousePosition);
  13. RaycastHit hit;
  14. if(Physics.Raycast(ray, out hit))
  15. group.position=hit.point;
  16. }
  17. }
  18. }