(공유) UNITY camera control by pbkim

using System.Collections;using System.Collections.Generic;using UnityEngine;public class moveObject : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { moveObjectFunc(); } private float speed_move = 3.0f; private float speed_rota = 2.0f; void moveObjectFunc() { float keyH = Input.GetAxis("Horizontal"); float keyV = Input.GetAxis("Vertical"); keyH = keyH * speed_move * Time.deltaTime; keyV = keyV * speed_move * Time.deltaTime; transform.Translate(Vector3.right * keyH); transform.Translate(Vector3.forward * keyV); float mouseX = Input.GetAxis("Mouse X"); float mouseY = Input.GetAxis("Mouse Y"); transform.Rotate(Vector3.up * speed_rota * mouseX); transform.Rotate(Vector3.left * speed_rota * mouseY); }}

덧글

  • 2018/05/31 14:59 # 비공개

    비공개 덧글입니다.
※ 로그인 사용자만 덧글을 남길 수 있습니다.

구글 468*60


Linked in

linknow profile