- Home /
Prevent object from passing through collider
I am building a 3D maze that is moved by the player. I'm taking a "labyrinth" approach and having a small ball be maneuvered through the maze when the player moves the maze. The problem occurs when the player moves a wall that the ball is currently resting on in the direction of the ball. The ball passes through the wall and stops on the next available wall.
The maze uses a mesh collider and rigidbody and the ball is a sphere collider.
I have drastically increased the physics frame rate to no avail. Considering the complexity of the maze and the potentially large number of maze combinations I really don't want to attach simple colliders to every wall. Any tips, tricks, suggestions, comments, etc. would be appreciated.
Answer by StephanK · May 18, 2010 at 06:48 PM
Does the player move walls or the whole labyrinth? If you move single walls within the maze, how is the mesh collider supposed to work correctly? How does the maze move? If you are using Translate or Rotate the physics engine won't see collisions that happen during movement. To fix this you'd need to move the maze by applying forces to it rather than moving its transform.
Answer by Ashkan_gc · May 18, 2010 at 07:03 PM
use box colliders for walls. also you can create big box colliders and make them parent of a group of balls if the player moves them by group and not one by one. you should place a web player demo or some code here and then others will be able to help more.
Your answer
Follow this Question
Related Questions
HELP ME!! importing stuff!!! 2 Answers
Rigidbody projectile gets stuck in two-sided Procedural mesh / mesh collider 0 Answers
Question on Collider Resource Consumption 0 Answers
enabling mesh collider for rigidbody screws up everything 0 Answers
Wheel has no friction on mesh collider of another GameObject. 0 Answers