- Home /
collider not working when apply "addForce" high enough
first time to ask question :), if this question had been answered please point me to the right one.
so, i have a sphere act like ball / or imagine pool / billiard game. i have plane with mesh collider and cube with mesh collider and i put wall material physic (when i remove it, doesn't solve the problem)., so the ball cant go off the plane.
when i addForce the ball the ball will bounce the cube collider. but when i addForce high enough, the ball will bounce off the cube, go through it, its like the cube collider doesn't working. sometimes it bounce 1-3 times then it bounced out.
i have ball physic apply on sphere also.
here my code to add force the ball :
rigidbody.AddForce(forceX*100*Time.deltaTime,0,forceZ*100*Time.deltaTime);
its Top View camera so i dont need y axis.
when forceX = 50 and forceZ = 50. the problem occur. i wondering why the ball can go through collider because i add force high enough to it.
please kindly giv direction. thanks
Answer by jjobby · Oct 27, 2010 at 07:39 AM
You can also try to change setting of Collision Detection in Rigidbody. I never use this before but it's a new attribute in Unity3. So, I think it should work too.
http://unity3d.com/support/documentation/Components/class-Rigidbody.html
Collision Detection Used to prevent fast moving objects from passing through other objects without detecting collisions.
Discrete - Used for normal collisions (This is the default value).
Continuous - Used for objects which the Continuous Dynamic detection needs to collide with.(This has a big impact on physics performance, leave it set to Discrete, if you don't have issues with collisions of fast objects).
Continuous Dynamic - Used for fast moving objects.
If I understand correctly, you need to set Continuous to your cube and Continuous Dynamic to your ball. Hope this help.
Thanks you, i added continuous dynamic to my sphere, then voila, it works... i dont have rigidBody on my cube so no need set continuous on it.
Answer by · Oct 27, 2010 at 05:58 AM
This is commonly known as the 'bullet through paper' effect.
In a single update, the ball is traveling far enough that it is on the other side of the collision.
UnifyCommunity has a 'DontGoThroughThings' script that "uses raycasting to avoid the physics engine letting fast-moving objects go through other objects (particularly meshes)."
Hope this helps.
This is perfect and much better on performance than using Collision Detection from rigidbodies! Thanks so much!
Your answer
![](https://koobas.hobune.stream/wayback/20220613081005im_/https://answers.unity.com/themes/thub/images/avi.jpg)