Ray hits bounds but not the object
#2
You should not pass the SceneNode to the GetAllHitObjects or GetHitSceneNodeBounds method if this SceneNode does not belong to the DXScene.

I have just added an additional check to the code that will throw an exception in this case and inform the user that this should not be done.

Also creating a ray from another DXScene will in most cases create invalid results (except when the camera and sizes are the same and the mouse position is relative to the DXScene).

So you should change your code into:
Code:
var dxScene = view.DXScene.RootNode != null ? view.DXScene : view.DXScene.MasterDXScene;
SceneNode rootNode = dxScene.RootNode;

Ray pickRay = dxScene.GetRayFromNearPlane((int)currentMousePosition.X, (int)currentMousePosition.Y);

dxScene.GetAllHitObjects(pickRay, rootNode)
dxScene.GetHitSceneNodeBounds(pickRay, rootNode)
Andrej Benedik
  


Messages In This Thread
Ray hits bounds but not the object - by janovrom - 02-15-2022, 12:06 PM
RE: Ray hits bounds but not the object - by abenedik - 02-15-2022, 12:42 PM

Forum Jump:


Users browsing this thread:
1 Guest(s)