Add input controller and malon model (i think)

This commit is contained in:
2022-08-13 12:18:32 -07:00
parent 5d1c3975f6
commit 4424d1546c
3 changed files with 243 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
using UnityEngine;
namespace Scampz.GameJam.Assets.Scripts
{
public class CharacterInputController : MonoBehaviour
{
private CharacterController _controller;
public float Speed = 5f;
public float RotateSpeed = 3.0f;
private void Start()
{
_controller = GetComponent<CharacterController>();
}
void Update()
{
// Rotation
transform.Rotate(0, Input.GetAxis(InputOptions.Horizontal) * RotateSpeed, 0);
// Move
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = Speed * Input.GetAxis(InputOptions.Vertical);
_controller.SimpleMove(forward * curSpeed);
}
}
}