Problem with collisions in Windows Form Applications

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
DanielLoynaz
Posts: 6
Joined: Tue Mar 11, 2008 5:06 pm

Problem with collisions in Windows Form Applications

Post by DanielLoynaz »

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
Insomniacp
Posts: 288
Joined: Wed Apr 16, 2008 1:45 am
Contact:

Re: Problem with collisions in Windows Form Applications

Post by Insomniacp »

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

Post by DanielLoynaz »

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!
blAaarg
Posts: 94
Joined: Tue Mar 02, 2010 9:11 pm
Location: SoCal

Re: Problem with collisions in Windows Form Applications

Post by blAaarg »

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
DanielLoynaz
Posts: 6
Joined: Tue Mar 11, 2008 5:06 pm

Re: Problem with collisions in Windows Form Applications

Post by DanielLoynaz »

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.
Post Reply