Object/Material is infront of Camera

时间:2018-02-15 12:29:45

标签: openinventor

I have start working with openinventor. I have a socube in viewer. I would like to check if socube is infront of camera or not. So when I move cube somewhere away from camera view value should be false.

SoSeparator root = new SoSeparator(); 
SoMaterial Material = new SoMaterial(); 
Material.diffuseColor.SetValue(1.0f, 0.0f, 0.0f);     // Red 
root.AddChild(Material); 
root.AddChild(new SoCone()); 
viewer = new SoWinExaminerViewer(this); 
viewer.SetTitle("Example 1.1 .NET"); 
viewer.SetSceneGraph(root); 
viewer.ViewAll(); 

Now I want to add a behavior something like if I move cone away from camera it returns false

1 个答案:

答案 0 :(得分:0)

我确认Open Inventor不提供实现此查询的方法。但是,可以使用可以查询的信息来编写一个。

如果您可以接受大致正确的答案,那么您的目标是回答以下问题:几何体的边界框是否与视锥体相交? 使用SoGetBoundingBoxAction获取边界框,然后从当前相机获取当前视图体积参数,例如查看器而> getCamera的() - > getViewVolume()