Gryphon_de Posted August 25, 2011 Posted August 25, 2011 Hello! I have a mesh with number of surfaces. How can I get height of the given surface in the given point (x,y)?
ulf.schroeter Posted August 25, 2011 Posted August 25, 2011 You can use engine.world.getIntersection() ray casts. Place start and and end point at your (x,y) with start point z above mesh bounding box z max and end point z below mesh bounding box z min.
Vladimir_tyutenkov Posted April 26, 2020 Posted April 26, 2020 Hello! how to get all the coordinates of the points of intersection of the surface with a given ray?
karpych11 Posted April 27, 2020 Posted April 27, 2020 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); } }
Recommended Posts