PlayerMove

Blockmove
both reset
This commit is contained in:
2026-01-23 14:44:44 +01:00
parent 2239f561d8
commit 047073fe8a
15 changed files with 397 additions and 35 deletions
+31
View File
@@ -0,0 +1,31 @@
using System;
using UnityEngine;
public class PlayerMove : MonoBehaviour
{
[SerializeField] private float speed;
[SerializeField] private Rigidbody rb;
[SerializeField] private Vector3 StartPos;
private void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
float horizontalInput = Input.GetAxis("Horizontal");
float verticalInput = Input.GetAxis("Vertical");
Vector3 moveDirection = new Vector3(horizontalInput,0, verticalInput);
moveDirection.Normalize();
transform.Translate(moveDirection * speed * Time.deltaTime, Space.World);
}
public void Reset()
{
this.transform.position = StartPos;
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9b9bab48a629093449f53dc5ea63d752