Created
March 13, 2018 04:57
-
-
Save am1tanaka/20c28e7c6e6eb14ed9cccb3f2dbddd57 to your computer and use it in GitHub Desktop.
Unity: マウス操作でオブジェクトを動かすスクリプト。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.Collections; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public class move : MonoBehaviour { | |
| void Update () { | |
| Vector3 mpos = Input.mousePosition; | |
| mpos.z = -Camera.main.transform.position.z; | |
| Vector3 wpos = Camera.main.ScreenToWorldPoint (mpos); | |
| transform.position = wpos; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment