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.

Dark GDK / Need Help With a Top-Down Shooter

Author
Message
PoZ
15
Years of Service
User Offline
Joined: 7th Jul 2009
Location:
Posted: 7th Jul 2009 22:51
Well, I had my experience on game maker, but i'm pretty new with 3D.
I am trying to make something like a 3d top down shooter.
the problem is that i cannot manage the player to point towards the mouse, i've already animated him and finished a lot of coding, but when i'm trying to get the mouse position it gets wrong.

here is what i came up with first, but i tried it in so many variations ant so many different ways...


does anyone see what the problem is?
Kylontario
15
Years of Service
User Offline
Joined: 7th Jul 2009
Location:
Posted: 8th Jul 2009 00:32
It looks like one of the mouse coord things is a function while the other is a variable. I'm pretty sure it would only be one or the other, so try making them both the same and see how that works.
ScapeSta
15
Years of Service
User Offline
Joined: 28th May 2009
Location:
Posted: 8th Jul 2009 04:01
This might work. I wouldn't know but give it a try. Instead of doing dbPointObject ( 1, dbMouseX ( ), 50, dbMouseZ ( ) );
dbPointObject ( 1, dbMouseX or maybe dbMousePositionX ( ) then etc.

"A job well done is a well done job."
PoZ
15
Years of Service
User Offline
Joined: 7th Jul 2009
Location:
Posted: 8th Jul 2009 15:43
I've already tried, making another object and positioning it on the mouse, but it didn't work either, does anyone know how to do that,
i mean, placing an object on the mouse position, if you do, please give me an example...
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 8th Jul 2009 20:17
The mouse coordinates are 2D (screen pixels) and your world and object coordinates are 3D. It will never work to use the mouse values directly, because it is a different coordinate system. Besides, the dbMouseZ() is not a coordinate at all, it means the movement of the mouse wheel in the current loop.

If you have a terrain, or at least a plain which acts as "floor" in your game, then you might have an easy solution with "pick object", or some more difficult solutions with "pick screen" vectors. Have a look at this thread to see if this is what you want:

http://forum.thegamecreators.com/?m=forum_view&t=152847&b=22

If your game is strictly top-down, there might be other clever, game-specific solutions but it is impossible to suggest something without knowing the whole program. Maybe you can somehow find out the edges of the world coordinates that are visible in the window (how, I don't have a clue) and if you know the window size in pixels, then the conversion is easy. But if the camera has even a slight angle, then this doesn't work any more. You need to find a solution which suits the way your game is coded.
PoZ
15
Years of Service
User Offline
Joined: 7th Jul 2009
Location:
Posted: 9th Jul 2009 20:31
Niceeeeeeeeeee,
it works great, just one problem i have, is that i want to do this just for the matrix, i mean like i wanna do exactly what it explains just that the object im "picking" will be the matrix so i would be able to continue working on the engine without making a terrein.

Login to post a reply

Server time is: 2024-10-01 06:04:58
Your offset time is: 2024-10-01 06:04:58