Skip to content

Instantly share code, notes, and snippets.

@lpberg
Created December 4, 2013 18:23
Show Gist options
  • Save lpberg/5ca2887bbef185e78724 to your computer and use it in GitHub Desktop.
Save lpberg/5ca2887bbef185e78724 to your computer and use it in GitHub Desktop.
working with intersection visitor
require("osgUtil")
my_sphere = Transform{Sphere{}}
my_line_seg = osg.LineSegment()
my_line_seg:set(Vec(0,2,0),Vec(0,-2,0))
my_intersect_vistor = osgUtil.IntersectVisitor()
my_intersect_vistor:addLineSegment(my_line_seg)
my_sphere:accept(my_intersect_vistor)
my_hit_list = osgUtil.IntersectVisitor.HitList()
help(my_intersect_vistor)
my_hit_list = my_intersect_vistor:getHitList()
-- my_result = osgUtil.Hit()
-- my_result = my_hit_list:front();
-- terrainHeight = my_result:getWorldIntersectPoint();
@rpavlik
Copy link

rpavlik commented Dec 6, 2013

line 12 is redundant. Just creating a hit list that will get garbage collected in short order

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment