Skip to content

Instantly share code, notes, and snippets.

@rpavlik
Forked from lpberg/gist:5ca2887bbef185e78724
Last active December 30, 2015 19:59
Show Gist options
  • Save rpavlik/e72a234a8e21f3d33759 to your computer and use it in GitHub Desktop.
Save rpavlik/e72a234a8e21f3d33759 to your computer and use it in GitHub Desktop.
my_sphere = osg.MatrixTransform()
require("osgUtil")
my_line_seg = osg.LineSegment()
my_line_seg:set(osg.Vec3d(0,2,0),osg.Vec3d(0,-2,0))
my_intersect_vistor = osgUtil.IntersectVisitor()
my_intersect_vistor:addLineSegment(my_line_seg)
my_sphere:accept(my_intersect_vistor)
my_hit_list = my_intersect_vistor:getHitList(my_line_seg)
-- my_result = osgUtil.Hit()
-- my_result = my_hit_list:front();
-- terrainHeight = my_result:getWorldIntersectPoint();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment