I updated my project from Unity 4.x to 5.x and now my collisions dont work like they used to.
Nothing at all has changed with my project.
This pic is of my Player’s inspector. There is no code relevant to its own collisions.
These next two pics are two different objects in my game.
They both have code that reacts to OnTriggerEnter, but it is not called anymore when the player touches it, and the player is now blocked by these objects.
Changing these objects to NOT a trigger, doesnt fix the problem.
Making them Kinematic doesnt help.
No combination of changes made to the RigidBody or the Collider seem to make any difference.
If its relevant, here is my floor. This works perfectly, blocks the character as it should.
The only thing I can think of is that theres some new defaulted option on thats messing up my collisions. My game is 2D if that matters, but since it was made in the old versions, its 3D as far as programming logic goes.
Here is the update function I have for my Player object. Shouldnt be affecting this issue.
void Update ()
{
if (gameObject.GetComponent<Rigidbody>().velocity.x > 10)
gameObject.GetComponent<Rigidbody>().velocity = new Vector3(10, gameObject.GetComponent<Rigidbody>().velocity.y);
else if(gameObject.GetComponent<Rigidbody>().velocity.x < -10)
gameObject.GetComponent<Rigidbody>().velocity = new Vector3(-10, gameObject.GetComponent<Rigidbody>().velocity.y);
if (gameObject.GetComponent<Rigidbody>().velocity.y > 10)
gameObject.GetComponent<Rigidbody>().velocity = new Vector3(gameObject.GetComponent<Rigidbody>().velocity.x, 10);
else if(gameObject.GetComponent<Rigidbody>().velocity.y < -10)
gameObject.GetComponent<Rigidbody>().velocity = new Vector3(gameObject.GetComponent<Rigidbody>().velocity.x, -10);;
if (gameObject.GetComponent<Rigidbody>().velocity.z != 0)
gameObject.GetComponent<Rigidbody>().velocity = new Vector3(gameObject.GetComponent<Rigidbody>().velocity.x, gameObject.GetComponent<Rigidbody>().velocity.y);
}