Using hit.normal to check if I hit the top of a cube?

Hi so I currently try to implement building in my game and now try to check which side I have hit. I’m using cubes so I thought using hit.normal would be easy to use but I can’t come up with something that works. Any ideas?

Given how much code you have posted, nope.

How to report problems productively in the Unity3D forums:

http://plbm.com/?p=220

Help us to help you.

1 Like

Yeah that’s a great way of checking! I would do this:

float angle = Vector3.Angle(hit.normal, Vector3.up);

bool wasTop = angle <= 45f;
1 Like

Thanks for the reply I will look forward to try to better myself at describing my problem

Thanks for the reply too! I tryied it out and it worked just perfectly! I often screw up working with angles but this is so simple that even I can oudenstand it. Thanks again!