백지부터 시작하는 이세계 유니티 생활 since 2020
unity 3D movement 구현하기
조아덕
2020. 11. 15. 20:01
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