Unity 3D Game Dev Day 1: Intro
There is a quick demo of player control using Unity's old Input system:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class OriginalPos : MonoBehaviour
{
[SerializeField] float xInput = 0f;
[SerializeField] float yInput = 0f;
[SerializeField] float zInput = 0f;
// Start is called before the first frame update
void Start()
{
// transform.position = new Vector3(-50,2,-10);
}
// Update is called once per frame
void Update()
{
float xInput = Input.GetAxis("Horizontal") * Time.deltaTime * 10f;
float zInput = Input.GetAxis("Vertical") * Time.deltaTime * 10f;
transform.Translate(xInput, yInput, zInput);
}
}
Attach the code to the Capsule can make it our player .