# How can I get the input of a side of a cube.

I am trying to stop the user from instantiating a prefab on a certain spot on a cube.
I have made the script to instantiate on the sides but I need to stop some parts.

If you’re using raycasting or some collision to determine the point where you instantiate on the surface of the cube, you can get the normal of the surface at the contact point.

If you convert the normal to world space, you can compare it with the world up/right directions, or with the local up/right of your cube. If you calculate the dot product of the surface normal and the local up-vector you get 1 for the top of the cube, -1 for the bottom and 0 for the sides. You can also compute angles if you need to differentiate between these sides, so compute the angle of the normal with the right-vector of the cube, then you can indentify the sides depending on if the angle is 0, 90, 180, 270.

Edit: You don’t have to convert the normal to world space, since it’s in local space (the cube’s local space I guess), so you can dot it with the cube’s local up.