Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Coding Fodder
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 5th Feb 2005 03:46
How do I click on an object in 3-D space. I do not want the object that has the closest xy on the screen. I simply want the object that provied the source color for any particular pixel. Like selecting objects in a modeling program. Thanks

Coding Fodder

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
Jake Blues
20
Years of Service
User Offline
Joined: 19th Jun 2004
Location: United States
Posted: 5th Feb 2005 04:34 Edited at: 5th Feb 2005 04:34
Here is the code I use. I don't remember where I found it, but I changed it a little bit, so you won't find it somewhere else.



Use this function to do it. The id is the object number and the objy is the objects y position.

The answer to the great question of life, the universe and everything is 42.
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 5th Feb 2005 06:31 Edited at: 5th Feb 2005 06:35
Is this what you want to do?


"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Coding Fodder
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 5th Feb 2005 08:07
RiiDii I have never come across that command. I will give it a try. I don't suppose that there is a way to get the coordinates of the pixel in the texturing image that was used to determine the screen pixel color. I am sure that my graphics card knows but its not sharing.

Thanks

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 5th Feb 2005 08:45
Don't know of any way to do that easily in DBP. I suppose you could triangulate where the point in 3D space is (afterall, you have the object's coordinates now). Then determine where your object is in 3D space (and the offset between the mouse). Take into consideration the object's orientation, and the texture scrolling/scaling, and you might get something pretty close. But WOW! That's a lot of math.

I'm pretty good with coming up with work-arounds though. If you care to share a little more about the end results you are trying to accomplish, I might be able to suggest an alternative.

Off hand, it sounds like you might be trying to "paint" the object's texture - while it's on the Object! That would have some very nifty applications (shadows, bullet holes, etc.). I'm not saying it's impossible, but it might not be practical. I think that's one of the reasons we don't see a lot of that around.

<RiiDii starts to ponder...> can it really be done? Sure! But can it be done at better than 2 FPS?

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Coding Fodder
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 5th Feb 2005 09:08
Actually I would like to do it for several reasons. the distant goal would be to paint objects. I believe that would require a pixel shader that can create bitmap on the fly. So nothing there for a while.

More immediately. *Warning major insite into my next game*

I have a Blackboard where I am displaying game information. I want the blackboard to be the menus as well. It is in a 3D environment. I want to be able to click on text and have a diffent menu displayed. Chalk buttons. I have done the math to locate it. It is huge. Ridiculously so. I think I am going to have to write my own routine that emulates what the graphics card does, but for only one pixel

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 5th Feb 2005 18:35 Edited at: 5th Feb 2005 18:37
Try This:



And This:



The first example is a deffinate work-around. You would have to make sure the blackboard was in the correct place and the correct angle (straight on).
The second shows some simple menu commands done in a format similar to the previous post. I understand that on the Pick Object command, having it check for a lot of objects can really slow you down. Work-around: have more tiers in your menu hierarchy.

Hope this helps.

Edit: Oh, almost forgot. In the second example you can use the arrow keys to move the camera around.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Coding Fodder
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 6th Feb 2005 07:32
I just got around to trying your code I think that it is going to work out pretty terrific thanks

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"

Login to post a reply

Server time is: 2025-06-04 18:25:51
Your offset time is: 2025-06-04 18:25:51