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.

Code Snippets / 3D object selection in DBClassic(No question)

Author
Message
cusoi
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: Netherlands
Posted: 6th May 2003 15:04
I see alot questions, I don't know this has been done already, because I don't need it, but I've been playing around a bit. And I have made a function. It's very simple. It just makes a tiny little sphere that moves from your camera position and then 1000(meter?) away. When it collides the function returns the number it collides to otherwise zero is returned. This is the function with an example program how to use it:
Pentium IV 2.4 GHZ 256 MB Ram Geforce 4 TI 4200 128 MB
Visit my site: www.cuso.tk
cusoi
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: Netherlands
Posted: 6th May 2003 15:14
It's really fast and accurate, it will always select the object when you're mouse is on it, but if you click a tiny milimeter away from the object it doesn't work!

Pentium IV 2.4 GHZ 256 MB Ram Geforce 4 TI 4200 128 MB
Visit my site: www.cuso.tk
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 6th May 2003 17:30 Edited at: 6th May 2003 18:27
yes, it work, but what some people want, it is the the mouse select the object, not the center
so you have to do the same, but not rotate the sphere as the camera, but .. I don't know how to explain it in english (I speak french ^^) ..
if you can move the mouse, you cannot use your system, and some people want to be able to move the mouse (for games as Warzone 2100), so you have to find the angle that is between the mouse and the camera, but .. oh, I don't know how to explain it ....
I'm not bad at mathematics, and I find the angles easy to find, but there's something odd.. look at it :



with it, we should have the good angles, but ... I don't know why, when the mouse is in the corners of the screen, it doesnt work at all, but when it stay near the middle of the height OR (nor and, or ) the middle of the width, it work very well....
I found the fovx# and fovy# by positionning a sphere where I see it in the up-right corner of the screen, so I know which angles are visibles on X and Y
but .. there's another way to do that .. whyn use the mouse and not a sprite that we paste on the true coordinates ? with the mouse we change the angles, we move the object, and when it hit something (maybe a banana ?) or it is very far, we stop it and paste the sprite on its coordinates .. I try to do that now

Bu$herie
How many civilians is he going to kill ? he's going to burn in hell, and I hope that his pain will make him inderstand !
Attreid
21
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 6th May 2003 18:51
here's an other code .. :


now, we have a code that work better that the last, but the mouse isn't draw very well, it's still a bit behind the true object's position ...
I think that it's a good start, but there are a few things to do :
1. when the mouse is in a corner, there's a small but, because of the limitation of the angle .. it can be repared easily
2. we cannot select an object, but I didn't do this code to select something, but to position an object at the mouse's coordinates ^^

Bu$herie
How many civilians is he going to kill ? he's going to burn in hell, and I hope that his pain will make him inderstand !
cusoi
21
Years of Service
User Offline
Joined: 3rd Jan 2003
Location: Netherlands
Posted: 6th May 2003 20:32
Bonjour, ça va bien? Je suis holandais. Je ne parle pas Francais bien...

I understand what you said . This is the object selection code with your code included(kind of), thank you very much!!! The only thing that needs fixing is the corner thingie. Maybe you know a solution. But it's much better than first now, merci beaucoup.



Pentium IV 2.4 GHZ 256 MB Ram Geforce 4 TI 4200 128 MB
Visit my site: www.cuso.tk

Login to post a reply

Server time is: 2024-04-20 14:57:46
Your offset time is: 2024-04-20 14:57:46