using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
private Rigidbody rb;
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
if (Physics.Raycast(transform.position, Vector3.down, GetComponent<BoxCollider>().size.y / 2 + 1f))
{
Quaternion rot = transform.rotation;
rot.z = Mathf.Round(rot.z / 95) * 95;
transform.rotation = rot;
if (Input.GetKeyDown(KeyCode.Space)) {
rb.velocity = Vector3.zero;
rb.AddForce(Vector2.up * 5000);
}
}
else {
transform.Rotate(Vector3.back * 5f);
}
}
}