Selecting objects in OGRE3D ...

Everything related to 3D programming
marc_256
Addict
Addict
Posts: 842
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Selecting objects in OGRE3D ...

Post 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
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
DarkDragon
Addict
Addict
Posts: 2345
Joined: Mon Jun 02, 2003 9:16 am
Location: Germany
Contact:

Re: Selecting objects in OGRE3D ...

Post 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.
bye,
Daniel
User avatar
minimy
Enthusiast
Enthusiast
Posts: 619
Joined: Mon Jul 08, 2013 8:43 pm
Location: off world

Re: Selecting objects in OGRE3D ...

Post 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!
If translation=Error: reply="Sorry, Im Spanish": Endif
marc_256
Addict
Addict
Posts: 842
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: Selecting objects in OGRE3D ...

Post 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,
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
Post Reply