Player going through walls
Hello everyone. i searched the whole internet and found no answer. so i'm gonna ask here. i have my player which is moved by this part of the script: Player.GetComponent().AddForce(Player.transform.forward * 20);
The player has a rigid body on him. the rigid body is not kinematic but has disabled gravity. In that part of the script i want my player to keep going forward and he does. but he goes into walls.
And i can't move my player with the character controller move option, because i disabled my character controller because i need to move my player on the y axis and the character controller doesn't allow that.
Answer by Dibbie · Jun 14, 2016 at 07:39 AM
Make sure you also have some type of collider on your player, be it a box collider or capsule collider (most common for characters), etc... What a Rigidbody does, is essentially adds physics to an object, the collider will allow those physics to be affected by the world or anything that should essentially have a "mass" of some type to it.
The object you are colliding with (in your case, the walls) should also have the same idea on them, at least a Rigidbody, and its always a fail-safe to add a collider as well, cause most often, you are missing one or the other on one of the 2 objects you are trying to get to collide properly.
Your answer
Follow this Question
Related Questions
How do I get objects in front of the player to be blasted away? 1 Answer
Throwing an object whilst moving 1 Answer
Ball Speed is not increasing as per code 0 Answers
Is there a way to "rotate" the direction of addForce (without using addRelativeForce)? 0 Answers
How to remove addforce effect 0 Answers