I using irrlicht in an Windows Form Application and I need that the visualized objects can be selected with the mouse, I am using the functions getRayFromScreenCoordinates and getSceneNodeFromRayBB of the getSceneCollisionManager but the result that I obtain they are as if the node was displaced of position, that is to say there are areas of the object in those that I cannot select it and areas outside of the object in those that I can him selecionar.
I have proven in applications of the type I consoled Application and this problem doesn't happen. Does somebody have some idea of as solving this?
Thanks!
pd: sorry my english is bad
Problem with collisions in Windows Form Applications
-
DanielLoynaz
- Posts: 6
- Joined: Tue Mar 11, 2008 5:06 pm
-
Insomniacp
- Posts: 288
- Joined: Wed Apr 16, 2008 1:45 am
- Contact:
Re: Problem with collisions in Windows Form Applications
it is possible you need to recalculate the bounding boxes on the objects. If you make a change through low level things it may not recalculate it automatically and this would cause it to have inaccurate data. You could try one of the different collision methods such as using a triangle selector and raycasting with that. I know there are a few other methods that perform the same basic task without using bounding boxes which may solve your problem.
-
DanielLoynaz
- Posts: 6
- Joined: Tue Mar 11, 2008 5:06 pm
Re: Problem with collisions in Windows Form Applications
Thank you for your answer Insomniacp.
The problem is not when determining the collisions, it seems that all this in the coordinates of the mouse (function getPosition of the CursorControl) it returns the coordinates Y (Height) displaced I added a factor and I obtained the prospective result. Although I don't know because it happens this, alone happens in Windows Form Application I am using the version 1.7.2 although with the version 1.6 also happen, if somebody knows that it is what could cause this or if it is a bug I would thank it to him.
Thanks!
The problem is not when determining the collisions, it seems that all this in the coordinates of the mouse (function getPosition of the CursorControl) it returns the coordinates Y (Height) displaced I added a factor and I obtained the prospective result. Although I don't know because it happens this, alone happens in Windows Form Application I am using the version 1.7.2 although with the version 1.6 also happen, if somebody knows that it is what could cause this or if it is a bug I would thank it to him.
Thanks!
Re: Problem with collisions in Windows Form Applications
Are you using setViewPort() to change the vertical dimension of the window that has the nodes you are trying to select? That will return mouse X,Y values that will be scaled down from the screen coordinates to fit the view port. I believe that behavior will be changed in Irrlicht 1.8.
"Computers don't make mistakes! What they do they do on purpose!!"
-Dale Gribble
-Dale Gribble
-
DanielLoynaz
- Posts: 6
- Joined: Tue Mar 11, 2008 5:06 pm
Re: Problem with collisions in Windows Form Applications
No, I was not using the function SetViewPort (). Starting from your suggestion I incorporated it in the Event Resize of the window now every time that changes the size of the window I reallocate the dimensions of the ViewPort and the results are the same ones. I continue without knowing because it is that this happens, although I have solved it with I commented them (subtracting a value to the coordinate AND of the Cursor) and I would like to know because it happens me this.
Thank you.
Thank you.