Surface height in given point (x,y)


photo

Recommended Posts

Hello!

I have a mesh with number of surfaces. How can I get height of the given surface in the given point (x,y)?

Link to post
  • 8 years later...

Hello!

how to get all the coordinates of the points of intersection of the surface with a given ray?

Link to post

Hello,

Using the GetIntersection function you can get only the first intersection point with an object or a list of all objects. But you can use multiple rays instead of one ray:

void get_intersection_points(Vec3 p1, Vec3 p2, int mask, Vector<vec3> &points)
{
    points.clear();

    WorldIntersectionPtr intersection = WorldIntersection::create();
    Vec3 direction = (p2 - p1).normalize();

    ObjectPtr hitObject = World::getIntersection(p1, p2, mask, intersection);
    while (hitObject)
    {
        points.append(intersection->getPoint());

        p1 = intersection->getPoint() + direction * UNIGINE_EPSILON;
        hitObject = World::getIntersection(p1, p2, mask, intersection);
    }
}

 

Link to post