ltrout

InputFollower

Mar 3rd, 2016
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. namespace FlingSoccer
  5. {
  6.     public class InputFollower : MonoBehaviour
  7.     {
  8.         void Start ()
  9.         {
  10.             transform.position = new Vector3 (transform.position.x, 1, transform.position.z);
  11.         }
  12.  
  13.         void Update ()
  14.         {
  15.             Vector3 point = Camera.main.ScreenToWorldPoint (new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 10));
  16.  
  17.             transform.position = new Vector3 (point.x, 1, point.z);
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment