백지부터 시작하는 이세계 코딩 생활
unity 3D movement 구현하기 본문
Horizontal , Vertical 좌표값을 조작하여 Object ( Player ) 를 움직이기.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player_HWPController : MonoBehaviour
{
private Rigidbody rigid;
private float moveForce = 7.0f;
private float x_Axis;
private float z_Axis;
// Start is called before the first frame update
void Start()
{
rigid = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
x_Axis = Input.GetAxis("Horizontal");
z_Axis = Input.GetAxis("Vertical");
Vector3 velocity = new Vector3(x_Axis, 0, z_Axis);
velocity *= moveForce;
rigid.velocity = velocity;
}
}
Ref. https://inyongs.tistory.com/17
[Unity 3D] 캐릭터 움직임 구현
오늘 해 볼 것은 유니티 게임의 기초 중에 기초를 배워보겠습니다. 캐릭터의 움직임 움직임을 구현하는 방법에는 여러가지가 있는데 차근차근 알아보겠습니다. 0. 기본셋팅 기본 셋팅으로 움직
inyongs.tistory.com
'백지부터 시작하는 이세계 유니티 생활 since 2020' 카테고리의 다른 글
Coroutine, IEnumerator, yield return (0) | 2020.11.17 |
---|---|
parameter, argument (0) | 2020.11.17 |
override, overload (0) | 2020.11.17 |
Time.deltatime (0) | 2020.11.17 |
Update(), Input.GetKey() (0) | 2020.11.16 |
Comments