26 lines
557 B
C#
26 lines
557 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlayerMovement : MonoBehaviour
|
|
{
|
|
public float movespeed = 5f;
|
|
|
|
public Rigidbody rb;
|
|
Vector3 movement;
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
{
|
|
//Input
|
|
movement.x = Input.GetAxisRaw("Horizontal");
|
|
movement.y = Input.GetAxisRaw("Vertical");
|
|
movement.z = 0;
|
|
}
|
|
|
|
void FixedUpdate() {
|
|
//Movement
|
|
rb.MovePosition(rb.position + movement * movespeed * Time.fixedDeltaTime);
|
|
}
|
|
}
|