AB4D Forum

Full Version: Problem of employ MouseEnter and MouseLeave on a Complex model
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have an application where I would like to have my Sofa model and Person model (dae format) highlighted when the mouse is over them. I would like the highlighting be the display of a half opacity bounding box of the model just like the picture shows. 
[attachment=85][attachment=86]

I have a strange problem getting an event notification from MouseEnter and MouseLeave events.
When I carefully move the mouse over the model, the mouseEnter event triggers and bounding box shows up,
but when I start to move the mouse pointer around the model (still on the model), the mouseLeave event triggers and bounding box disappear. And it happened repeatedly, mouseEnter and mouseLeave, mouseEnter and mouseLeave. And the bounding box just blink as the mouse moves on the model.

Since the model is very complex, I use the root group (Model3DGroup) as the event's source.

Any help will be great, thanks a lot.
 
When you show the bounding box, it is shown over your 3D model and this makes the mouse hit the bounding box instead of the model - this triggers the mouse leave event.

To prevent the bounding box from being hit by EventManager3D use the RegisterExcludedVisual3D method on EventManager3D and pass the Visual3D that is used to show the bounding box. This will remove it from being hit. When you hide the bounding box from the scene, call the RemoveExcludedVisual3D method so that it will not be checked again.