hit testing! how to suppress Input events in Unity?
working on the evaluation still...
I have a Button, and behind it is a collider with OnMouseDrag() OnMouseUp(), etc. How do I prevent the OnMouse* methods from running, if the player clicked or dragged on the button, for instance?
I have read the docs and searched the forums. I learned there is an example of HitTest() here,
http://www.noesisengine.com/docs/Gui.Co ... orial.html
But that's C++ code and I have no idea what the code context is or what those variables are. Can you provide some examples of how to suppress input events from the Unity C# side of things?
HitTesting is pretty basic requirement that pretty much everyone is going to run into sooner or later. It seems like there should be some code in Samples/ having to do with Hit testing?
Also Your C# plugin does not seem to have any code comments (in visual studio- all the methods I have looked at don't have any inline documentation). Is there a reason for this? For example- I am trying to figure out how to use
VisualTreeHelper.HitTest(). But the parameters are Noesis.Visual, and Noesis.Point. No idea how to find or create the required parameters, to perform the test.
I have a Button, and behind it is a collider with OnMouseDrag() OnMouseUp(), etc. How do I prevent the OnMouse* methods from running, if the player clicked or dragged on the button, for instance?
I have read the docs and searched the forums. I learned there is an example of HitTest() here,
http://www.noesisengine.com/docs/Gui.Co ... orial.html
But that's C++ code and I have no idea what the code context is or what those variables are. Can you provide some examples of how to suppress input events from the Unity C# side of things?
HitTesting is pretty basic requirement that pretty much everyone is going to run into sooner or later. It seems like there should be some code in Samples/ having to do with Hit testing?
Also Your C# plugin does not seem to have any code comments (in visual studio- all the methods I have looked at don't have any inline documentation). Is there a reason for this? For example- I am trying to figure out how to use
VisualTreeHelper.HitTest(). But the parameters are Noesis.Visual, and Noesis.Point. No idea how to find or create the required parameters, to perform the test.
-
-
sfernandez
Site Admin
- Posts: 3222
- Joined:
Re: hit testing! how to suppress Input events in Unity?
You should use the VisualTreeHelper.HitTest() as follows:
You are right, this code is very useful, and we should have some example of this in the documentation. We will add it in a following release.
About the lack of inline documentation in the C# classes, is because we are using SWIG to automatically create C# proxy classes from the native plugin classes. This tool does not embed the C++ documentation, but we are investigating the best way to incorporate it to the C# classes. Will be done as soon as possible.
Code: Select all
// You can obtain the 'root' element through the NoesisGUIPanel component, GetRoot method
// The 'mousePos' in screen coordinates, with Y growing from top to bottom of the screen
HitTestResult hit = VisualTreeHelper.HitTest(root, mousepos);
if (hit.visualHit == null)
{
// No UI element was hit
// ...your collider code here
}
About the lack of inline documentation in the C# classes, is because we are using SWIG to automatically create C# proxy classes from the native plugin classes. This tool does not embed the C++ documentation, but we are investigating the best way to incorporate it to the C# classes. Will be done as soon as possible.
Re: hit testing! how to suppress Input events in Unity?
Thanks that is a lot simpler than I was expecting for some reason!
Who is online
Users browsing this forum: jsantos and 0 guests