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 / Storing mouse values in a loop- Problem

Author
Message
Daryn Alsup
16
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 7th Oct 2008 03:25
Okay I need some direction with storing mouse values. My problem revolves around placing an object on a grid the same width and height as my screen size and inverting the height of the screen and subtracting the MouseY() to convert from 2d to 3d. This is of course done to place an object.



And here's the object placement/main loop:


The problem is the object placement. Can some one help me clear this up a bit?

use whatever object you want

-Daryn

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Garion
16
Years of Service
User Offline
Joined: 7th Dec 2007
Location: Poland
Posted: 7th Oct 2008 14:29
mousex and mousey get the 2d coordinates
to place the 3d object on a 3d position you need 3d coordinates...

use this



1 and 1 are the objects checked, from 1 to 1


btw remember to use SYNC ON, SYNC too...
Daryn Alsup
16
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 7th Oct 2008 21:32
let me reiterate, figure it like drawing a line. I need to store the first clicks location on the matrix and the second location at the release of the click... sort of point to point if you will. From this I can configure the objects angle and orientation based on the position of the mouse... this was helpful Garion. Thank you.

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Bursar
16
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 8th Oct 2008 00:46 Edited at: 8th Oct 2008 00:48
So something like this might do the trick? :

I'm a relative beginner at this though, so I might have overlooked something. The code isn't a complete program, but it only needs a few bits putting in to make it complete.
Daryn Alsup
16
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 8th Oct 2008 03:48
Bursar THANKS! It's not exactly what i needed, but I can get what I need from what you gave me. I've never really been a fan of the "pick object" commands... I know their pupose just not how to use them... alas, you both have helped thanks again and I'll post what I find

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
Daryn Alsup
16
Years of Service
User Offline
Joined: 5th Jul 2008
Location: In your head... dun dun DUN!!!!!!!!
Posted: 8th Oct 2008 04:00
Okay lol, now I have another question that is rather harder to answer (let alone code) so if some one can point me in the correct direction I'm sure I can figure it out... SO here it is. Since we're drawing lines with a 3d object (road for example) how would I go about rotating the object as to point in the direction of the last click? Fun time trying to figure this out I'll tell you that!

Jack and Jill went up a hill to fetch a pale of water... but Jill got tired of his s#%& so she shot him.
calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 8th Oct 2008 22:43
Yrotate object or point object will work fine for you. You'd either point the object towards the position, or find the direction based on ATANFULL(). I think that it's easier for beginners to use point object, due to its relative simplicity.

I assume you have a function to convert 2D to 3D coordinates. DBPro's native command for this is pick screen, although I did manage to write a substitute.

The pick screen command is very useful. The arguments/parameters for the command are as follows:

X position (in pixels)
Y position (in pixels)
distance (in units)

This will project a point distance units from the camera. To get the position of this point (relative to the camera), use the commands:

get pick vector X()
get pick vector Y()
get pick vector Z()


A good example of this is the code that I helped Mugen Wizardry width.

http://forum.thegamecreators.com/?m=forum_view&t=136607&b=1

Good luck,
Calcyman

The optomist's right, The pessimist's right.

Login to post a reply

Server time is: 2024-11-25 16:46:49
Your offset time is: 2024-11-25 16:46:49