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 Professional Discussion / 2 questions about 3d space and particles

Author
Message
Pikapooh
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 27th Sep 2002 23:19
hi all, i have 2 questions,
the first one regard the mouse in 3D space, im trying to figure out how to obtain the coords of where my mouse clicks on the matrix, mousex() function just seems to give the mouse posistion on flat screen if u get what i mean.

my second question is about the particle functions, ive been playing with the make particle () function and for some reason when i make a new particle emitter the cameras posistion and rotation all focuses on the particles which is not what i want, i want particles to be created anywhere on my matrix not nessesarly in view so it really annoys me! hehe. I know i could get the cameras posistion and rotation then revert it to that once the particles have been made but thats quite a messy solution and i cant belive that there isnt a built in way to prevent this,


thanx very much
Pikapooh
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 27th Sep 2002 23:23
i have just realised that it seems to be setting my camera to 0,0 every time, so its not nessesarly focusing on the particles, but neway ive been over my code and i have no camera changing code in there
randi
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United States
Posted: 27th Sep 2002 23:43
You will need to use the 'object screen x(#)' and 'object screen y(#)' command to get the positions of objects on the screen.
To use this with a matrix...
Try placing an object at the point the matrix location and then use the above commands.
Know what I mean???


As far as the camera thing...
I think you are talking about the 'auto camera'.
If auto camera is on, which it is by default, the camera points to any object that gets loaded or created. I suppose this is the case for particles too.
You should use the 'autocam off' command to stop this.
I think that's what you are talking about.

Randi
Pikapooh
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 28th Sep 2002 04:29
thanx very much, the autocam thing worked great, but the 3d position thing isnt quite what im looking for, u c i dont have an object. im trying to find where the mouse has been clicked on the matrix, like a RTS when u click someone on the ground the troops go to that location

i need a similar thing, rite now im only getting the flat screens coords by using mousex() mousey() mousez() but i need the coords of them in 3D space so i can alter things on my matrix.

thanx
Pikapooh
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 28th Sep 2002 16:13
ne ideas ne one?
xtom
21
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Ireland
Posted: 28th Sep 2002 17:50
You can use a hidden object as a position locator between the 3d world and the mouse.
Pikapooh
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 28th Sep 2002 18:06
oki, i have a hidden object, but im still a little stuck, whats the code to move that object when i move my mouse (object moving in 3D space)

thanx
Pikapooh
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 28th Sep 2002 23:14
anyone here?
randi
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United States
Posted: 29th Sep 2002 01:29
Only thing I can think of to get the 3D position of a matrix by using the mouse is...

When ever you click...
A loop starts placing a hidden object at every point on the matrix...
At each point is checks to see if the mouse is on it by using 'object screen x()' and 'object screen y()'.

This should work and get you closer.
I don't know about speed though.
Try it and see.

Randi
Pikapooh
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 29th Sep 2002 04:15
hehe yea i think that would hinder the speed of things and be quite a messy solution, i cant belive there isnt a command already built into DB for this??

ive seen a RTS game create in DB which uses the same kinda thing im looking for, wonder how they did it :S

any suggestions are really appreachiated!!
thanx every from help so far
Milamber
21
Years of Service
User Offline
Joined: 27th Sep 2002
Location: Australia
Posted: 29th Sep 2002 10:50
One way you could do it is to have an object being moved around by the mouse just in front of the camera, then project that object along until it hits the matrix and find those coordinates. Not sure how well this would work, but I just thought it up and figured it might be worth a shot.

System Specs: AMD Athlon 1700+ XP, GA-7VRX motherboard, 128MB DDR RAM, GeForce2 MX400 64MB VRAM
Zed
21
Years of Service
User Offline
Joined: 20th Sep 2002
Location:
Posted: 29th Sep 2002 12:24
I'd give RAndi's suggestion a try - It's easy to implement and hidden objects can be moved very quickly.

The Darthster
21
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 29th Sep 2002 22:41
Since you're doing a 3d rts, why not replace the 2d mouse cursor with a 3d cursor that hovers just over the matrix? If you had an arrow model or something, then used mousemovex() and mousemovey() to move it, then you wouldn't need to do any translating, the mouse position would already be in 3d space. Then if you need a 2d mouse pointer for on-screen menus and the like, check to see if the object screen position of your 3d pointer is on the 2d menus, then position the mouse there using set mouse position and use a 2d cursor.

Login to post a reply

Server time is: 2024-04-19 17:33:13
Your offset time is: 2024-04-19 17:33:13