So my problem is this: if I continue to press forward next to a cube with my hand-crafted first person controller, he tries to pass through the cube.
This was my first try at fixing this…
if(!Physics.Raycast(transform.position, Vector3.forward, 1))
{
transform.Translate(x, 0, 0);
Debug.Log("test");
}
if(!Physics.Raycast(transform.position, Vector3.left, 1) && !Physics.Raycast(transform.position, Vector3.right, 1))
{
transform.Translate(0, 0, z);
}
…but it didn’t work. I think I simply scripted the if statements wrong, but…