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 / Need help with calculating object distance

Author
Message
Francesco
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: Milan, Italy
Posted: 18th Apr 2004 13:39 Edited at: 18th Apr 2004 17:00
In my programme there are 12 spheres than move randomly in a 100,100,100 tranparent box, and I wanted to make these objects not overlap but turn and move when they are close more than x. I tryed using a math calculation, but it doesn't work (the objects still overlap) so if anybody modifies my programme
to make it work, I would be vary happy if you sent it to me (nerofrancesco@hotmail.com) or post it in a reply.
Sorry for my English and for the mess in my programme(I didn't even put one comment)!
Bye

Non si inalberi mica con me, sa!
Lei è venuto qui, lei ha il tombino intasato!
Siamo uno spurgo serio, noi!
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 18th Apr 2004 14:28
why not just use set object radius to make the collision zone for the object larger than the object? (or am I missing something here?)

Mentor.

PC1: P4 hyperthreading 3ghz, 1gig mem, 2x160gig hd`s, ATI radeon 9800 pro gfx, 6 way surround sound, PC2: AMD 1.2ghz, 512mb ram, FX5200 ultra gfx, stereo 16 bit soundblaster, ups.
Francesco
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: Milan, Italy
Posted: 18th Apr 2004 16:42
I actually have darkbasic and do not have darkbasic professional, wich I suppose that command comes from. Any other suggestions??

Non si inalberi mica con me, sa!
Lei è venuto qui, lei ha il tombino intasato!
Siamo uno spurgo serio, noi!
KC27
20
Years of Service
User Offline
Joined: 18th Mar 2004
Location:
Posted: 18th Apr 2004 16:45
If you mean 3D distance between two objects, heres a basic formula that I use.


Francesco
20
Years of Service
User Offline
Joined: 11th Apr 2004
Location: Milan, Italy
Posted: 18th Apr 2004 16:57 Edited at: 18th Apr 2004 16:59
Ok, thanks for that formula, but how can I adapt it to all of the objects (I have 12)?
Here is my code

Could somebody give it a look?

Non si inalberi mica con me, sa!
Lei è venuto qui, lei ha il tombino intasato!
Siamo uno spurgo serio, noi!
KC27
20
Years of Service
User Offline
Joined: 18th Mar 2004
Location:
Posted: 18th Apr 2004 17:22
Well, i tried, you could just use a for next loop to check distances, but I am too busy to do the work for you.

Login to post a reply

Server time is: 2024-09-22 06:42:59
Your offset time is: 2024-09-22 06:42:59