Jump to content

Surface height in given point (x,y)


photo

Recommended Posts

  • 8 years later...

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 comment
×
×
  • Create New...