- Home /
How do I prevent an object from going though the wall?
My player object has a Rigidbody
on it. The mesh collider on the player is set as Convex. My terrain has a mesh collider on it, it is not set as Convex.
It seems if I move against the wall, and keep trying, eventually the player object goes through the wall. If I go much further I fall, endlessly.
I can't set the terrain to Convex, as its not convex...
The Rigidbody on the player is se to Continuous Collision Detection and to Extrapolate for the Interpolate option.
How can I stop the player from going through walls?
Answer by Graphics_Dev · Mar 07, 2016 at 02:20 PM
http://docs.unity3d.com/Manual/class-Rigidbody.html
Adjust the fixed and maximum allowed timestep.
Does a "Fixed Timestamp" of 0.005
make sense? Seems thats what I need so the ship doesn't go through the walls.
It may have to be. Check your physics performance in the profiler to see what the trade-off is.
Answer by 5c4r3cr0w · Mar 14, 2016 at 11:44 AM
I had this problem before. Problem was wrong approach to control the movements when dealing with rigid bodies . Use physics functions like Addforce or just simply change Velocity if you want rigid body to move don't use transform functions , because overwrites physics engine values in next frame.
Answer by cmonroy · Mar 10, 2016 at 02:14 AM
You may get better results using box colliders intead of mesh colliders...
I had a similar problem when my environment was full of mesh colliders that was solved by using simpler box colliders.
Your answer
