-
-
Save lpberg/5ca2887bbef185e78724 to your computer and use it in GitHub Desktop.
working with intersection visitor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 12 is redundant. Just creating a hit list that will get garbage collected in short order