I don’t think this has anything to do with my character controller, but I have included that at the bottom in case it is causing this.
On the inverse corners of my map (the acute 90-degree angle INSIDE a box), if I continuously push against them and look around a bit I clip through it pretty violently.
I wouldn’t have even noticed had I not tried to use my staircase (a stairwell encased in a long vertical rectangular tube) as once I try to go up it fast and hit a corner on the way up I go straight through it with little to no effort and end up falling forever.
I am using a mesh collider as the stairwell as 2 doorways, 1 at the top and 1 at the bottom which meant I can’t use a box collider for obvious reasons.
Why is the collision in Unity so dodgy and not in other engines, despite them all using PhysX? And is there any way to fix this? Flying through walls while going up a flight of stairs is a pretty show-stopping issue…
As promised…my controller, just in case:
/*
* ---- Character Controller: Character Movement ----
*
* To Add:
* Smoother Movement
* Better Collision w/ Movement
* Setup as Static to Save Settings
* */
using UnityEngine;
public class CharacterController : MonoBehaviour
{
public static CharacterController playerController;
public float speed = 10.0f;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
if (!PlayerControl.playerControl.isPaused)
{
if (Input.anyKeyDown)
{
Cursor.lockState = CursorLockMode.Locked;
}
float translation = Input.GetAxis("Vertical") * speed;
float straffe = Input.GetAxis("Horizontal") * speed;
translation *= Time.deltaTime;
straffe *= Time.deltaTime;
Vector3 moveDir = new Vector3(straffe, 0, translation);
moveDir = transform.TransformDirection(moveDir);
GetComponent<Rigidbody>().MovePosition(transform.position + moveDir);
if (Input.GetKeyDown(PlayerControl.playerControl.pauseKey))
{
Cursor.lockState = CursorLockMode.None;
}
}
}
}
The PlayerControl stuff is just a static class holding control schemes.