mirror of
https://github.com/PashaBibko/The-Mobius-Line.git
synced 2026-04-04 01:49:07 +00:00
Epilepsy sim
This commit is contained in:
@@ -4,6 +4,10 @@ public partial class PlayerMovement : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
m_WallCollisions.Add(other);
|
||||
// Stops it trying to find the normals of portals
|
||||
// if (other.CompareTag("Portal")) { return; }
|
||||
|
||||
// Else adds it to the list
|
||||
// m_WallCollisions.Add(other);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,9 +82,27 @@ public partial class PlayerMovement : MonoBehaviour
|
||||
//
|
||||
Vector3 m_WallNormal;
|
||||
|
||||
// Only instance of the player
|
||||
static PlayerMovement s_Instance;
|
||||
|
||||
public static Transform Orientation() => s_Instance.m_Orientation;
|
||||
public static Vector3 Pos() => s_Instance.transform.position;
|
||||
public static void SetPos(Vector3 v) => s_Instance.transform.parent.position = v;
|
||||
public static GameObject Object() => s_Instance.gameObject;
|
||||
|
||||
// Start is called before the first frame update
|
||||
private void Start()
|
||||
{
|
||||
// Checks there is not more than one player at one time
|
||||
if (s_Instance != null)
|
||||
{
|
||||
Debug.LogError("Multiple players");
|
||||
return;
|
||||
}
|
||||
|
||||
// Sets it to the instance
|
||||
s_Instance = this;
|
||||
|
||||
// Stops the rigidbody from rotatating when we don't want it to
|
||||
m_Body.freezeRotation = true;
|
||||
|
||||
|
||||
@@ -31,8 +31,7 @@ public partial class PlayerMovement : MonoBehaviour
|
||||
Vector3 point = closest.ClosestPoint(transform.position);
|
||||
Vector3 dir = point - transform.position;
|
||||
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(transform.position, dir.normalized, out hit, (m_WallCheckDistance * 2.0f) + 1.0f, m_GroundMask))
|
||||
if (Physics.Raycast(transform.position, dir.normalized, out RaycastHit hit, (m_WallCheckDistance * 2.0f) + 1.0f, m_GroundMask))
|
||||
{
|
||||
normal = hit.normal;
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user