# How to calculate the surface area of one side of an object?

I need to find the area of the side closest to another object.

Now it’s a quadrilateral, but the problem is that I don’t know what shape the surface will have for the calculation.

Firstly, I think that I need to somehow get this side itself, but I do not know how.
I had ideas to try to somehow get this side with raycast, but I don’t know how to do it right.

Maybe someone has other ideas?

Sorry for a possibly stupid question, I’m new at Unity

Kinda depends on what kind of geometry you’re working with, and how you define the side of the object.

A solution that would work in your picture is to raycast towards the center of the object, and get the triangle you hit from the raycast result. Then, search through adjacent triangles to that triangle (ones that share two vertices), and check if they’ve got approximately the same normal as the triangle you hit. In that case, include that triangle as well. Take the area of all the triangles you found, add them together.

1 Like