- Home /
Player goes through ceiling when using Physics.Gravity.
Hello. When im adding this script to player......well its working pretty good,player is flying up,but it will not stop,its even going through ceiling,i mean rigibody which is attached to player does not detect collisions at all,player just go through walls,i need help to fix this,please someone help me :)
Physics.gravity = Vector3(0, 50, 0);
And if you comment out this line everything works fine???
Does your ceiling have a bounding box on it, and is the "Trigger" option deselected? Does the player move really fast? You could turn on Continuous Dynamic collisions in the rigidbody if so and try changing the interpolation setting. Also make sure the room you are standing in, is not inside of a collider.
Answer by Agemennon · Nov 27, 2013 at 05:23 PM
You are changing gravity for every rigidbody in the scene, and not changing it back, unless you are planning on making a game where the gravity changes over time.
I'd say you want to make your player jump, so what you probably want to look at is Rigidbody.AddForce
Your player clips throw the ceiling I imagine because he is accelerating upwards at 50 meters/second (roughly 5x Earth Gravity, in the wrong direction), and achieves a high enough speed to act like the collider is not there.
Your answer
Follow this Question
Related Questions
Apply low gravity only for specific object. 1 Answer
How to do this? 2 Answers
Faux Gravity Prolem? #2 2 Answers
(C#)How To Disable Gravity From Script? 4 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers