Rigidbodey does not what it should do. (javascript)

hello.
My BounceBall-Object moves on an 2d-grid (y-movement and rotation is freezed by javascript)
2 Walls should break if the Ball hits them with a minimum of velocity. The Script
for these Walls looks like this:

#pragma strict

var Ball:Transform;

function OnCollisionEnter (collision:Collision) {

if(collision.gameObject.name==“BounceBall”){

if(Ball.rigidbody.velocity.x>0.6){
transform.active=false;
}

else if(Ball.rigidbody.velocity.z>0.6){
transform.active=false;
}

}

}

The Problem is… If the Ball hits such a Wall with low speed, the Wall breaks. But if the Ball is very fast, the Wall doesnt break…
what am i doing wrong? ( well… I am a Beginner so i also expect a quite stupid mistake… :slight_smile: )

Can think of one possible thing, the wall may be too thin and at extremely high speed the ball never “touches” it, it just sort of teleports through it since it’s going that fast. Try making it thicker.

From my understanding, the collider does not check to see if things “should hit” instead it updates positions every frame and, should something find itself during the frame in a collision, the call of OnTriggerEntered gets executed. If the object moves fast enough that the frame-to-frame movement results in the ball always being past the wall, then it never gets triggered.

In some cases, making wall thicker may not be a perfect solution and you may find yourself needing either to limit movement speed or to use advance techniques like raycasting, but I guess for now you are just experimenting so for now just make the wall bigger and see if that helps.

thanks for your answer.
I know that “is not touching at all”-problem i am experianced with this…

but the Ball always gets reflected. But still destroys the Wall by low speed, but not by fast.
I think I will try to “check” if the ball is colliding at all with the wall by script…

if id doesnt, i will make the wall bigger, if it does, I thing there is a problem with the vareables “velocity” in this scripe… i think…