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 / PICK OBJECT for DarkBASIC 1.13 Enchanced

Author
Message
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 6th Sep 2003 00:53 Edited at: 6th Sep 2003 17:07
This code detects if the mouse is hovering over an object. It's fast on high poly objects, but not on too many low poly objects (due to the speed of "object screen" commands). It could be good for level editors.

It uses 2 functions, the first is "update object pick()" which stores the memblock data of an object in an array, to reduce slowdown. This means that whenever you move/rotate/scale an object you should update it to have accurate detection. "pick object" returns a 1 if the mouse is on the object.

Syntax:
pick object(object number)
update pick object(object number)

Below is an example with functions. Up+down = zoom.

It's probably best used in conjunction with a distance test for relatively cube shaped objects.

FIXED CODE BELOW, NOT IN SOURCE BUTTON!!!



100 Cubes test...



Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 6th Sep 2003 16:05
Thats why I have no replys, the source got screwed up. Code fixed now.

Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 6th Sep 2003 17:06
New example. 100 cubes, I get 40 fps.

Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 7th Sep 2003 21:18
Lol, no wonder no one is answering, I just spotted the 3D lib post .

Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
Mattman
21
Years of Service
User Offline
Joined: 5th Jun 2003
Location: East Lansing
Posted: 8th Sep 2003 06:52
Might use it for my secret project coming up.

Got a knack for finding secrets??? Jingot Racing --- A new brand of Racing --- Only from Nightwatch Studios
"hey, it's tomorrow" --- Hamish
Toilet Freak
22
Years of Service
User Offline
Joined: 16th Dec 2002
Location: Australia
Posted: 8th Sep 2003 07:43
cool

DreamersScars-Toiletfreak-
If you need a animated chara go here... It isn't that great but it'll do as a tester model thingy http://users.tpg.com.au/users/cnkyk8k2/index.html
Pricey
22
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 18th Sep 2003 21:41
usefull...

My programs don't crash... your computer does

http://johnsgamesuk.topcities.com
=C=
22
Years of Service
User Offline
Joined: 8th May 2003
Location: United Kingdom
Posted: 25th Sep 2003 18:13
What thread are you talking about hamish when you say

Lol, no wonder no one is answering, I just spotted the 3D lib post

I like your approach but I dotn think it works when objects are lock on

Maybe the other thread you are talking about has another pick object command...

cheers if you remember!

-------------------------------
Pointy birds, Oh pointy pointy
Anoint my head, Anointy 'nointy
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 25th Sep 2003 19:02
No, it won't work when the objects are locked to the screen, as it uses the actual 3D coordinates of the object, locking them means that the coordinates are changed.

Yeah, there was another post with a whole 3D library that is better. It detects the closest poly being picked and comes in a DLL.

Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
Kelebrindae
21
Years of Service
User Offline
Joined: 15th Sep 2003
Location: Where cheeses are scarier than dragons.
Posted: 25th Sep 2003 19:31
Do you have the address of this post ?

Ideas: memories of things which did not occur yet...
Hamish McHaggis
22
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 25th Sep 2003 21:18
http://darkbasicpro.thegamecreators.com/?m=forum_view&t=15735&b=10

Brains are for idiots.

Athelon XP 1400 Plus - Nvidia Geforce MX400 - 256mb RAM
Ocean Runner
22
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 26th Sep 2003 06:11
Very useful. Thanks.

"Computers in the future may weigh no more then
1.5 tons.
- Popular Mechanics, 1949

Login to post a reply

Server time is: 2025-05-20 17:28:28
Your offset time is: 2025-05-20 17:28:28