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
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 15th Nov 2002 22:23
I remember this discussion from my few and highly sporadic days on the DB Standard forum. Now, I want to know if the system for 3D mouse coordinates is easier/better/worse in DB Pro.

Think point-and-click: could you theoretically create a strategy game environment with DBPro (that is - clicking a model's approximate coordinates and then clicking somewhere in the 3D space)?

I know that the first part (clicking approximate coordinates) works, but I had problems figuring out the second part (getting 3D space coordinates from mouse) in DB Standard.
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 16th Nov 2002 00:54
Did no one else have this problem?

I remember it used to be a discussion - if it isn't anymore, is that because people have simply quit making games that require 3D mouse coordinates or is it because it works nowadays?

Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 16th Nov 2002 02:19
Your problem is that it's totally impossible to convert a 2D mouse click into a 3D co-ordinate without some point of reference. Imagine your 3D world is a box, and your 2D screen is the top panel of the box. You can move your mouse cursor all around that top panel, but there's no way of figuring out how far into the box you want to go.

The only 3D mouse code I and others put together (that I remember) was matrix or object orientated 3D mouse clicks. The object or matrix becomes the final variable to calculate the 3D co-ordinate. The basic principle was to fire an object from the camera, towards the target object/matrix, with respect to the cursor position, to arrive at a co-ordinate on that target object/matrix.

Like I said though, it's impossible to arrive a 3D co-ordinate in empty space using a 2D mouse pointer.

Machine: P4 2200, 512MB, GeForce4 64MB, Audigy Platinum

There's a junglist inside every coder. http://www.kontact-kru.com for my own personal breakbeat terrorism.
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 16th Nov 2002 02:49
Shouldn't it be possible to calculate approximate position? I mean, using depth calculation or similar?

There are obviously a lot of games out there that do this, so somehow it should be possible. Not that DB is the most complete language in history, however, but as long as it uses fundamental 3D, which it should, I would hypothesize that it is possible.

Will take some figuring out, though. I don't think it's impossible, however... or I hope it isn't.

Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 16th Nov 2002 13:34
It is impossible. Trust me. It defiest the laws of physics and maths which were derived by better men than you or I. You need that 3rd point of reference.

This is what is impossible:
Imagine you're making a space game. You've selected the ship you want to make and you're looking at an empty void of space on screen and you want to click where to move to. That's impossible. It's hard to explain, but if you can agree that the mouse cursor onscreen is a 2D movement, and space is 3D, then you should be able to see that the 3rd dimensional position is missing.

There are three work arounds:
(1) Is have an object in the 3D world that you're clicking on. 3D space co-ordinates will be on that objects surface, or relative to this object. This means you can, for example, make a 3D RTS game where tanks are moving over a landscape. The reason this is possible is because the ground is the 3rd point of reference, and is used to figure out depth/distance from the 2D screen.

(2) The second method is to simply have a set equation or distance for depth-from-screen relative to camera angles etc. This is pretty useless because it'll be very limiting.

(3) The only way to get a true 3D co-ordinate in 3D space with a 2D mouse cursor is too use more than one input. It's impossible to derive the position with one mouse click, but it is possible to set a directional vector from the camera with one mouse click, then set the distance/depth with another mouse movement and click, or with cursor keys or something. That sets up your 3rd dimension.

Remember how I mentioned the box about. Well, moving the mouse is moving around on the top panel of the box. Clicking sets your position on the top panel. You need that second mouse movement, or cursor key movement to then tell the system how far to travel inside the box. Then you have your 3D co-ordinate.

Machine: P4 2200, 512MB, GeForce4 64MB, Audigy Platinum

There's a junglist inside every coder. http://www.kontact-kru.com for my own personal breakbeat terrorism.
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 16th Nov 2002 18:08
So, what you are saying is that you need a point of reference? Hmmm.

Either that, or you could simply translate 2d coordinates between the two. I.e., come up with a formula that sets the standards between 2D and 3D. For example using a set size (say 1000) for your matrix and then simply translating coordinates. This would be pretty much useless, however, since it would not really be worth the effort and produce a highly inaccurate end product.

This is a real dilemma... because I somehow need that 3D transition. Would be interesting to challenge people here on the discussion board to come up with a fully functional Mouse 3D code that does not take up more than X FPS.

Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 16th Nov 2002 20:09
The question is, what are you actually trying to achieve? I'm trying to speak very generically here, but if you gave me an example of how you wanted to use your 3D mouse clicks, I might be able to suggest what you could do to fill in that 3rd dimension. There are lots of programs in many games that use a mouse to interact with 3D space .. but it's not totally straight forward.

Machine: P4 2200, 512MB, GeForce4 64MB, Audigy Platinum

There's a junglist inside every coder. http://www.kontact-kru.com for my own personal breakbeat terrorism.
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 16th Nov 2002 20:28
Ok. My intention:

1) A dynamic 3D environment where you can strategically use your characters, be they tanks or whatever (will not be revealed until beginning of next year), no matter what camera zoom or rotation you choose. It is still, however, centered on a low-scale environment. Compare it to Baldur's Gate or Starcraft interaction; or for other 3D references Warcraft III or Ground Control.

2) Simple graphical interface with tactical options such as the classical patrol option in War- and Starcraft games.

3) All this applied in a .BSP environment, perhaps enhanced by matrices for backdrops and large-scale simulation. (Take the example of the Rune game, where they have actual 3D objects as mountains in the far horizon, to simulate that you can actually reach them, although you can't of course.)

4) Summary statement: "A dynamic point-and-click interface in a 3D environment."

simonuk74
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location:
Posted: 16th Nov 2002 21:11
Hmm... well heres a game that works on a 2D screen, but gives the `FEELING` of 3D control... HomeWorld...

I have seen, somewhere in the old realgame forums a piece of code VERY similar to Homeworld style control.
heres the idea behind it, ( as far as I remember )

the world - SPACE - was a sphere, with the user camera at R distance from the center. the camera position could be zoomed in/out, and rotated about the center of the sphere.
so if the object you wanted to select was behind another object, you just `swing` the camera until you can see the object needed.
but overall, it was still using 2D mouse co-ordinates.

but heres an idea I just thought of....
If you are using 3D objects or a matrix for the ground, can you somehow - when you click on the screen at mouseX/Y, cant you reference that to what co-ordinate X/Y of the matrix is at the `clicked` screen co-ordrinate?, then you could get the Z co-ordinate from `get ground height` command?

I know that it IS possible to get the matrix co-ordinate at a certain screen screen co-ordinate, no matter of zoom or matrix zero position in reference to the cam, as I have coded one, for my level editor I was programming.

Just one catch, the cam was DIRECTLY ABOVE the matrix, looking STRAIGHT DOWN, I feared that if I tried to alter the angle of the camera it may have been a complete re-write of most of the code, but I`m not saying it cant be done!?

simon

brittd
21
Years of Service
User Offline
Joined: 28th Oct 2002
Location:
Posted: 16th Nov 2002 22:20
I hate when people say it is impossible to do something. Sorry Follout, but it is not. I have code right now that Finds the 3d vector of Line Of Site not matter what direction. From there I can move the mouse around on the screen and get the 3d vector of the mouse position on screen and point it out into space. All that is needed to do then is check to see if where the vector intersects with the object you are trying to click on. Example I can fan anyplace of a Matrix I am clicking on no matter what angle I am facing the matrix from. With this info you can pick up a 3d object (ie tank, car) and put it down anyplace else on that matrix. Which is what I am guessing is what entomophobiac is wanting to do. The only problem with the code is I have it built for 1 specific screen size & Camera FOV (44degrees) I am write now trying to change the code so the math I used with change with screen resolution and camera FOV angle. If I get that done this weekend I will upload the basic code. All the code will do however is find the vector pointing out into 3d space from mouse x,y based on current Line-of-site. You will have to make the code check intersection of matrix.
Sunny Day
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 17th Nov 2002 01:54
Here are my experiments with 3d-mouse
They are made in DB but work also in DBP

http://koti.mbnet.fi/ketonen/db/aster/aster.htm

So 3d mouse is just as easy and fun as everything else
in DB.

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 17th Nov 2002 02:53
I wrote some 3dmouse code for my game, but it was rather specific for my needs i.e the mouse is mapped to a *flat* plane in space (I've represented this with a matrix) and you need to know the point that the camera is looking at on this plane.
Nevertheless I've decided to let you have it as it may still be of use to some people, I have commented the code and made two versions, one for DB and one for DBPro.
Hope this helps someone.

http://sparky152.homestead.com/files/3dmouse_Orig_DB_.dba

http://sparky152.homestead.com/files/3dmouse_DBPRO.dba

Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 17th Nov 2002 03:54
brittd ... you just echoed what I said. It *is* impossible to get a 3D point in space with a single mouse click and nothing else as a reference. All you can get is a vector, which *is not* a 3D point in space. It's a line containing an infinite number of 3D points that obey an equation. To get a 3D point in space, you need an object or second method to derive the depth. I only said it was impossible to get a 3D position in empty space with a single mouse click ... which it is, but with a point of reference, like an object or matrix, it is possible to fire a vector towards the object using the x,y mouse co-ordinates and find a position of intersect, but that's clearly not using just the x,y position of the mouse and nothing else to get a 3D point in space.

I was under the impression entomophobiac was trying to make a homeworld style game where he could select a ship with the mouse (very easy) and then click on the screen in empty space to give the ship a destination. That isn't possible. Clicking on a surface can be calculated though, although the method I used needs working free flight rotation to calculate, so it's pretty useless till that works.

Machine: P4 2200, 512MB, GeForce4 64MB, Audigy Platinum

There's a junglist inside every coder. http://www.kontact-kru.com for my own personal breakbeat terrorism.
indi
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 17th Nov 2002 05:12
mike mentions a 3d pick command soon so keep your ears to the ground.

TheNVS
21
Years of Service
User Offline
Joined: 25th Oct 2002
Location: United States
Posted: 17th Nov 2002 06:09
you see, what Fallout is trying to say is that the mouse is 2d. space is 3d(real space is undefined but looks 3d). you will need the last dimension to tell the depth. you could use another input command to define the last dimension.

you could position an object by mousex(),get ground height(1,x,y),mousey() with some camera angle maths and other little stuff. the 3 dimensions is defined. but clicking and moving the 2d mouse on to a 3d space with 2 dimensions without any other input to tell what the depth is, like what Fallout said, impossible according to what we know. it just does not make any sense. you could alawys have a 3d object as a 3d mouse with the two mouse dimensions and an input.

you could also pick an object with a 2d mouse with camera angle. but you cant tell what the depth of the 2d mouse is when pointing to only space. though, you could make it look like your doing it by printing the depth of the object being hovered by the mouse.

brittd
21
Years of Service
User Offline
Joined: 28th Oct 2002
Location:
Posted: 17th Nov 2002 10:00
well maybe I am being pig headed but I do find the 3d space cordinates, just not the distance. Having a vector based off mouse position would work for entomophiac.
Here is what he said in first post.
(
"Think point-and-click: could you theoretically create a strategy game environment with DBPro (that is - clicking a model's approximate coordinates and then clicking somewhere in the 3D space)?

I know that the first part (clicking approximate coordinates) works, but I had problems figuring out the second part (getting 3D space coordinates from mouse) in DB Standard."
)

This is easy since the "getting 3d space cordinates from your mouse" just means where you point on screen to the matrix location. You just click on the screen and see where the vector hits the matrix or terrain. Bingo with my vector you can find where it hits the Matrix and places the Tank or what ever you want to place.

This mean yes to the "very first post". You can do it with DBPro. It takes some math but not Impossible as suggest. I made the code for exactly that reason. I wanted to be able to pick up object in 3d and place them back in 3d.

I have finished my coding and figured out everthing I need to do to make it adaptable to screen size change & FOV. Just need to rewrite which I will do on Sunday.
Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 17th Nov 2002 13:23
Thanks victor. Glad someone else sees my perspective.

brittd, yes, finding a 3d space position on the matrix is possible. As victor said, the get ground height command fills in the 3rd dimension. However ...
"Think point-and-click: could you theoretically create a strategy game environment with DBPro (that is - clicking a model's approximate coordinates and then clicking somewhere in the 3D space)?"

He didn't define it was on a matrix. If he had, I would've said the same thing as you. It's quite easy to calculate the position the user is clicking on the matrix. I thought it meant empty 3D space, for a space sim, and I still assure you this is impossible. You said it yourself actually. You derive a vector from the mouse positions and all you need is depth. A vector IS NOT a 3d co-ordinate in space. It's an infinite amount of them. That depth/distance thing you keep mentioning is the final piece of the puzzle.

Look at it this way. When you click on the matrix, you make a vector with the mouse cursor and then you derive the distance/depth by moving an object towards the surface of the matrix until it collides. At that point, you have your 3D co-ordinate, right? So if space is empty, you could fire your object down that vector and you'd never collide with anything, and therefore never arrive at a 3d co-ordinate. Without a solid surface to click on, or a 2nd input to choose depth, there is no way of telling the computer how far to travel down that vector, and therefore it's impossible to result in a specific co-ordinate.

Machine: P4 2200, 512MB, GeForce4 64MB, Audigy Platinum

There's a junglist inside every coder. http://www.kontact-kru.com for my own personal breakbeat terrorism.
brittd
21
Years of Service
User Offline
Joined: 28th Oct 2002
Location:
Posted: 17th Nov 2002 17:40
My mouse has a Wheel that I use with my vector to find any 3d location in space with or without the Matrix. You just point with you mouse, and then use scroll button to determine how far away the object is from the Camera.

Once again I stand my my statment, yes you can use a mouse to position any object in 3d space.

If anyone is still interested in my code, let me know and I will post it to the code area.
entomophobiac
21
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 17th Nov 2002 21:59
It seems that there should be work-arounds for most parts of this, and I am more than delighted to see that it raises an issue. Because I have had a truckload of problems myself.

Still, when it comes to the words and phrasages, I would say that Fallout is right in his 'reference' speech: without any point of reference, 2D can never become 3D. It is simply a matter of fact. Even use of the mouse wheel would be considered a reference in this respect. Because "reference" does not have to be a set object-reference but can be a simple number boundary as well, such as "a Wheel that I use with my vector to find any 3d location in space".

At least that is how I would interpret the discussion. Still, technicalities might void the accuracy of this statement, since I don't have the perspective of individual code.

I will be highly interested in reviewing your work brittd, if you ever publish it here. It seems that it can definitely fix some of my issues... (Issues... there are ALWAYS issues.)

Thanks folks.

brittd
21
Years of Service
User Offline
Joined: 28th Oct 2002
Location:
Posted: 18th Nov 2002 07:00
Here is a rough copy of my code. All it does at the moment is let you move around a X,Y axis with mouse 1&2 buttons. Use the mouse X,Y position on screen to find the screen vector and scale it to Z (mouse wheel). This would be easily adaptable to say place an object anyplace in 3D space with just the mouse.

Fallout
21
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 18th Nov 2002 14:11
brittd. Please understand I'm only saying it's impossible to determine a 3D position in space with a single 2D mouse click. Your mouse wheel may work but that's the 2nd input I was refering to. It's impossible to just use the single mouse click and it's x,y co-ordinates without a 2nd input (e.g. your mouse wheel) or a reference object etc.

Machine: P4 2200, 512MB, GeForce4 64MB, Audigy Platinum

There's a junglist inside every coder. http://www.kontact-kru.com for my own personal breakbeat terrorism.
simonuk74
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location:
Posted: 18th Nov 2002 20:47
ok, heres a stupid idea.... lol

How about a new kinda mouse ????? lol
one that somehow can generate an X,Y,Z co-ordinate ?
not too sure how this would work, but would be very handy.
Maybe I`ll invent one

I`m off to do some pre-liminary sketches


simon

TheNVS
21
Years of Service
User Offline
Joined: 25th Oct 2002
Location: United States
Posted: 19th Nov 2002 00:09
simonuk74, your crazy.

The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 19th Nov 2002 00:29
No, all you'd need is one of those pen things people use for modelling and stuff. It's basically a pen on a jointed arm that moves in 3d. However I don't know where to buy on, and I'm pretty sure the people who play your games won't have one.
simonuk74
21
Years of Service
User Offline
Joined: 3rd Nov 2002
Location:
Posted: 19th Nov 2002 01:23
lol well I thought of one of the pen things, I have seen them about on the net, but they cost LOADS, 500 or more!

I know I`m crazy , I like to design stuff...
I just need do something to make money from, so I can be rich lol

but also, Microsoft bought out that mouse/joyad thing, it had loads of stuff to move, twist & turn...

the problem is here, would DB support it, or something similar ?

Anarchist451
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location:
Posted: 25th Nov 2002 03:12
Could you not produce a 2d plane according to camera angle and find the intersect said plane and x,y coord's of the mouse click?

Login to post a reply

Server time is: 2024-05-07 06:26:39
Your offset time is: 2024-05-07 06:26:39