Normals not perpendicular to surface?!

Hello, this is my first question here in this community. I’ve already searched for my problem for a while and the documentation for unity wasnt that helpful (again).

Ok here’s my Problem. I’m trying around with unity and programmed a little script that lets balls bounce of walls. The balls got a rigidbody and the walls got a box collider each. I’ve tested everything that came into my mind (for about 4hours now) but the normals seem not perpendicular to the walls on the top and the left. If I increase the velocity of a ball the bending gets even worse. It always ends up the balls just bouncing in 180° of a wall.

May the problem be that iam setting the velocity within the OnCollisionEnter event? dunno

Here’s the Code I’m using. I hope you guys can help me out I’m kind of depressed right now :

    void OnCollisionEnter(Collision c){
            Debug.DrawRay(c.contacts[0].point, c.contacts[0].normal,, 6);
            Vector3 inDirection = gameObject.transform.forward;
            Vector3 inNormal = c.contacts[0].normal;
            Vector3 outDirection = Vector3.Reflect(gameObject.transform.forward, inNormal) * speed;
            gameObject.rigidbody.velocity = outDirection;
            lastNormal = inNormal;
            lastCollisionPosition = c.contacts[0].point;
            gameObject.transform.LookAt(gameObject.transform.position + gameObject.rigidbody.velocity);


(visualized via Debug.DrawRay(c.contacts[0].point, c.contacts[0].normal,, 6)

dont go with “seem” check.

Debug.DrawRay(c.contacts[0].point, c.contacts[0].normal,,5)

or something like that. basically draw a debug ray and make sure you have debug button enabled in gameplay view of editor so you can see the widgets.

I think your problem is the contacts.normal is a local normal not a global normal and you need to use transform.TransformDirection to make the local normals be properly oriented because the indirection of transform.forward is global and the normal is local.