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.

DarkBASIC Discussion / How do I point 3D objects with the mouse pointer?

Author
Message
Video Boy
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location:
Posted: 10th Apr 2005 23:41 Edited at: 10th Apr 2005 23:47
If you ever played Sentinel Returns, you'll know that the player can move the mouse pointer around the screen to point any 3D object in the landscapes, and if you press the left mouse button, the pointed object will be absorbed (if you don't know what I'm talking about, you can download the demo from http://www.3dgamers.com/dlselect/games/sentinelreturns/sentineldemo.zip.html; the game works fine on modern machines with the OpenGlide wrapper, which you can download from http://sourceforge.net/projects/openglide/)

I know for a fact that the mouse pointer isn't actually interacting with the object; the moving light source which you move across the landscape with your mouse is. I realized this by playing the game with stereoscopic glasses, thanks to which you can see that the mouse pointer is not part of the 3D game field at all.
I'm trying to do something similar, but I can't figure out what formula I need to make it LOOK LIKE the moving light (which moves in the 3D environment) is always under the mouse pointer (which moves on the 2D screen).

Who can help me?
WhizzRich
22
Years of Service
User Offline
Joined: 30th Nov 2002
Location:
Posted: 12th Apr 2005 10:13
hey, never played sentinel returns, but if ur game has the camera above the landscape pointed directly down (pitch camera down 90) then u can use this entry from the codebase:

http://www.thegamecreators.com/?m=codebase_view&i=70b6c10548ffbcc2cec1c7dc07d61fd4

never needed to try it with any other camera angle, but if u need a slanted camera or something u can fiddle around with it and u mite be able to make it work.

WhizzRich ---
Video Boy
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location:
Posted: 14th Apr 2005 05:00
Unfortunately, the matter is more complicated than that, because the angle is not fixed. The game is seen in first person and you can move what I call the "scanning light" in 2 ways:
1) if you just move the mouse around, the scanning light moves forward when you move the pointer up; backward if you move the pointer down; left if you move it left and right if you move it right
2) if you hold the right mouse button, you can look around as you can do in any FPS (even if the game is not an FPS). The pointer remains fixed on the screen, while the scanning light follows your gaze across the landscape, always remaining under the pointer. If you move the mouse left or right, the scanning light rotates around the camera; if you move it up or down, the scanning light will be directly under you when you look down, and it will be at the edge of the landscape (theoretically, it should be at an infinite distance) if you look directly ahead.

If you try the Sentinel Returns demo you'll immediately understand what I mean.
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 14th Apr 2005 05:24
So you are asking to let the light follow your mouse pointer?
Video Boy
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location:
Posted: 15th Apr 2005 03:50
Basically, yes.
By the way, I kinda figured out the second method:


where:
TG# is the horizontal distance between the camera and the light
x#, y# and z# are the coordinates of the light.

Note that I said "kinda" because now the light moves in the same way it does in Sentinel Returns, but I still can't figure out how to make the movements of the pointer match the movements of the light.
And the first method (moving the light without looking around) is still totally obscure for me.

Login to post a reply

Server time is: 2025-05-23 16:49:08
Your offset time is: 2025-05-23 16:49:08