So I created this small model for a room.
It’s a box with its normals inverted so I can see the walls on the inside.
It’s also one sided so I can see through it from the outside.
In Unity I check the Generate Colliders option and add into the game world.
But when I move my character, from the inside, to the wall. instead of bumping into it he walks straight through, why is this? and how do I fix it?
My character also has a collider on it.
Because you are inside the collider, since your room is a box, that means that mesh collider is going to create a big box, and it will only detect collisions on the outside. If you want to make a room, put together like 6 cubes, each being for a wall and ceiling. Hope this helps!
Thanks, for your answers.
But I found the problem and fixed it.
Because my movement was transform.Transalte it was forcing its way through anything, because it techincally wasn’t moving. It was acting more like a teleport.
I replaced it with
if (cc.isGrounded) {
moveDirection = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical"));
moveDirection = transform.TransformDirection (moveDirection);
moveDirection *= moveSpeed;
}
moveDirection.y -= gravity * Time.deltaTime;
cc.Move(moveDirection * Time.deltaTime);
My only problem now is that I don’t have the customization that I wanted for sprinting only when moving forward and stuff like that, but it doesn’t matter to much to me.
Hope this helps if someone encounters this problem in the future.