- Home /
Player flies upward off the map when it collides with a vertical mesh collider
I have an issue where my Player is walking along and bumps into, say, a tunnel wall. Normally, it would just not let the character pass through (which is good), BUT for some reason it is making my player shoot upwards through the mesh and off into space high in the sky.
I have no idea why it is doing this. I am using only prefabs from previous scenes (which worked correcly) If anyone has had this problem or knows about some variable or component that I could tweak to fix the issue I'd appreciate it.
Answer by The_r0nin · Dec 08, 2010 at 05:07 PM
If your collider is not striking flat surface against flat surface (which is actually pretty rare outside of box colliders) and the player has an additional forward velocity, then some of the force of the collision is directed upwards (orthagonal to the direction of collision. If you aren't using gravity, as soon as your player gains a velocity in the y direction, there is no damping that will act to reduce this velocity, so your player flies upwards and never stops.
I ran into this in my game (I had rigidbodies and no gravity). Simply code your own gravity function [if (!isGrounded) {AddForce(Vector3(0,0,-10*Time.deltaTime);}... or something like this] and it should prevent this.
Your answer
Follow this Question
Related Questions
How to get a Character to move with a moving platform ? 6 Answers
CharacterController:disable character-to-character collision 2 Answers
Voxel engine physics 3rd person character controller 1 Answer
early collision above character controller 2 Answers
How to stop first person player from walking through animated door 1 Answer