Page 1 of 1

Selecting objects in OGRE3D ...

Posted: Sun May 19, 2024 7:26 pm
by marc_256
Hello,

First at all, 3D (OGRE) is great, but very difficult to understand and build a virtual world ...


I need some help with selection of objects in OGRE3D.

What I'm dreaming of ...

In my virtual 3D world, I want some machine HUI (Human User Interfaces) control panels.
I created some of them in very high details (this was a huge work).
So, when I come near them, I can see the status of a switch, control lamp, ...

But, I want to go a little further,
When I passes over an object in 3D world and pushes the [ALT] key,
there is an property box that opens and shows the object info.
to see the part#, the manufacturer, the spare part order#, the function of the object ...

Till there all works well, see images below.

I position my (fixed) cursor in the middle of the screen ...
And when I click the right mouse button I want to select the 3D object and see the info PropertyBox.


But how can I select an object in 3D world ?
there are more objects in line (behind) the first object.


Thanks,
marc


Image



Image



Image

Re: Selecting objects in OGRE3D ...

Posted: Sun May 19, 2024 8:11 pm
by DarkDragon
What you want is called picking.

https://www.purebasic.com/documentation ... epick.html
https://www.purebasic.com/documentation ... tpick.html

However I think it might not be correctly implemented, usually you'd render the scene onto a texture where each object has it's own color and read the pixels of that image at the positions you want. I think in former times it has been done that way but it has been changed to raycasting the bounding boxes, which is not hardware accelerated at all and very inaccurate. However it also has some other advantages. E.g. you don't have to change the rendering pipeline to handle colorization for that purpose. I think in Ogre that's not very feasible.

Re: Selecting objects in OGRE3D ...

Posted: Sun May 19, 2024 9:28 pm
by minimy
Hello, maybe the example included with PB called 'BodyPick.pb' will help you. I hope so.
MousePick(),PointPick() and RayPick() may be interesting too.
Best regards!

Re: Selecting objects in OGRE3D ...

Posted: Mon May 20, 2024 2:17 pm
by marc_256
Hi DarkDragon and minimy,

thanks for the answers,
that is my problem, when i do a pick, it selects the bounding box of the object.
But I see there are other possibility ...

marc,