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.

Newcomers DBPro Corner / Interaction with 3D objects using the cursor.

Author
Message
Bafflebox
14
Years of Service
User Offline
Joined: 25th Aug 2010
Location:
Posted: 25th Aug 2010 19:44
I couldn't find it, read over it or just didn't look well enough, but! I can't figure it out. Could someone point me in the right direction?

I'm running into a couple of problems. For one, I don't think there's a nice user-friendly mapping program for MUD games, and certainly not one in 3D (which would ultimately be so much more convenient, since you can usually also go up and down in those)

But, figuring out how to place boxes automatically, with an ID number (so the title could be edited later) and all that funky jazz seemed to be a couple notches above beginner level, so I'd first like to know how to interact using the mouse cursor with 3D objects. Think... menubuttons with expanding textboxes some place else (preferably also 3D)

Why 3D? It's fancy :3
I'd like to make 'em wobble slightly, too.
Hope you can help!
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 26th Aug 2010 00:42 Edited at: 26th Aug 2010 00:43
I'm not quite sure what you're after or what your skill level is, but I'm guessing the command you want is PICK OBJECT. It lets you put in a 2D screen location (such as the location of the cursor) and tells you whether there are any objects there in 3D space, so it's good for clicking on buttons in 3D.

mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 26th Aug 2010 01:05 Edited at: 26th Aug 2010 01:09
Here is the Pick Object example right out of the help files.


F1 will teach you more than anything!

Mike

some cool stuff someone else said here
Bafflebox
14
Years of Service
User Offline
Joined: 25th Aug 2010
Location:
Posted: 26th Aug 2010 08:56
Ahh~ I thought I had mentioned everything, before! Sorry for being incomplete in my request ^_^;

Although that is a very cool start, it has to be a 3 dimensional clickable area (I think?) because even when the camera moves, the object must both maintain it's own position and still remain interactable. If that makes sense?

So, when I move or rotate the camera to the left, that cube must still be clickable and show some sort of effect (different stage, I want it to work first; for now a color change would work fine)

While I have little experience programming in Dark Basic, I have used (hehe) MSX Basic, QBasic, C++ and PHP before. Granted, I never wrote anything fantastic, but I guess, I really don't know what my level is :o

I'm certainly beyond "Hello, world!", but I don't now how far in I am toward an intermediate or advanced level.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 26th Aug 2010 17:15
Quote: "So, when I move or rotate the camera to the left, that cube must still be clickable and show some sort of effect (different stage, I want it to work first; for now a color change would work fine)"

Ah, I see. I threw together an example that illustrates this. Even though you're not a complete beginner, you should see some of the basic tutorials at the top of the DBP Newcomers forum list so you can figure out the exact syntax of DB.

Another good way to learn is to take existing code (like this example) and try to modify it, for example, make the button wobble when the mouse is held over it as you suggested.



Bafflebox
14
Years of Service
User Offline
Joined: 25th Aug 2010
Location:
Posted: 27th Aug 2010 12:26
Thanks! That works like a charm.
One point of inquery is, once you rotate too far either left or right, the cube disappears entirely. It's not that it's a complaint, but I just wonder what causes it, do you know? ^_^
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 27th Aug 2010 17:56
Hum...I have no idea why it's doing that. Seems to be happening at -76 degrees and 32 degrees . Sorry, I haven't the slightest idea.


Latest progress: Fog of War implemented
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 28th Aug 2010 05:24
Quote: "One point of inquery is, once you rotate too far either left or right, the cube disappears entirely. It's not that it's a complaint, but I just wonder what causes it, do you know? ^_^ "


It looks like the OFFSET LIMB command is causing it. My guess would be that the camera sometimes thinks the object is offscreen even when it's not and gets confused when culling... but I honestly have no idea . Here's a work-around though. Instead of using OFFSET LIMB I offset the object from the camera's position manually in the loop:




Guns, cinematics, stealth, items and more!

Login to post a reply

Server time is: 2024-09-28 20:24:18
Your offset time is: 2024-09-28 20:24:18