02-15-2022, 12:42 PM
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:
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

