Getting both normals from two collision objects

Hi,

I know I can get a normal of contact point for the object that is enterting into the collider by below,

void OnCollisionEnter(Collision otherCol)
{
Vector3 myCollisionNormal = otherCol.contacts[0].normal;
}

though, I coudn`t fine a way to get the normal vector of its own collision point ( object that has the script is attatched to)?

I am using raycast at the moment, but it dosent work sometimes.

Thanks in advance for your suggestions.

Arthur.

This answer is going to sound dumb.

Vector3 myCollisionNormal = otherCol.contacts[0].normal;

Vector3 otherCollisionNormal = -myCollisionNormal;

Simply flip (make negative) the normal you have. That is the other direction.

Thanks for your reply, thoough I am looking main object side of collision point normal,

Say, When I have the script attatched to a cub which collide with a sphere, I can get collision point noral of the sphere, But I coudn`t find a way to get a collision point normal of the cube.

I hope this clear things out little…

thanks.

I believe if you test it, you will find that I am right. Any time you have a collision, it calls both objects with the same collision information, the only difference is the normal is inverted.

So, your cube, will give the opposite normal as the sphere.

Cube side of normal should be perpendicular to its face( and collision box), I can`t see how it will be reverse of shpere normal. When I use Raycast, I get the result that I expected, but it is not consistance.

but that is the beauty, it is not perpendicular to its face.

If you want a one specific to a side, then you should use a Raycast in the opposite direction of the normal.

Physics.Raycast(hit.point + hit.normal, -hit.normal, hit)

This, in effect is your reverse ray. I do not know what effect it will give you when pointed at a edge or corner of a cube.

I will give this a try, Thank you bigmisterb.

It cause same problem that I have, I am currently using Raycast and it works 85% of time. Problme is though it misses time to time and return value from the object behind my target object( Maybe becuase the contack point is slightly beyond collision point of the objct?), So I would like to find a way to get the normal without using ray cast.

If anyone familiar with this please let me know.