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 / detect whether or not your "inside" object?

Author
Message
Mugen Wizardry
User Banned
Posted: 16th May 2010 23:02
how can i detect for instance if im inside a sphere?

i would like to know this so i can create "zones"

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 16th May 2010 23:47
anyone?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Alfa x
20
Years of Service
User Offline
Joined: 1st Jul 2006
Location: Colombia
Posted: 17th May 2010 00:12
Do you have some code that you tried?
Mugen Wizardry
User Banned
Posted: 17th May 2010 00:14
no. cuz i dont know what command
to use to do this.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
Mugen Wizardry
User Banned
Posted: 17th May 2010 00:58
does anyone have like a formula or small example preferably the latter i can use?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 17th May 2010 02:57
use ianm's matrix1 plugin, it has zone functions.

TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th May 2010 03:28
Mugen Wizardry:

Please don't multiple-post. This is a forum, not a chat room, so you won't get quick replies most of the time. Less than an hour isn't a lot of time to wait.

If you need to add something before someone else has replied, please use the 'Edit' button.

TDK

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 17th May 2010 10:26


My signature is NOT a moderator plaything! Stop changing it!
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 17th May 2010 14:20
If it's 2D, then I suggest learning some line to line collision and circle collision and then make the system yourself.

If you have a convex sequence of lines making a zone, like a shape made from lines around the walls for instance, then it's quite straightforward to work out if your inside or outside of the zone. If you could the number of collisions between the camera position X and Z, and some far away point outside of the zone, then you can use that to tell if its inside or outside. Just check to see if the count is odd or even, if it's 0,2,4,6,8 then you are outside the zone, if there is 1,3,5,7,9 collisions then you are inside the zone. I think it would work out faster than object collision, but probably slower than rotated boxes - really it depends on the shape of your zones, how complex are they, and how complex is the level itself.

Circular zones could use a simple 2D distance check. The real challenge is organizing it all without using a ton of memory.


Health, Ammo, and bacon and eggs!
Mugen Wizardry
User Banned
Posted: 17th May 2010 16:40
i prefer ian's plugin

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD! http://www.imageposeidon.com/

Login to post a reply

Server time is: 2026-07-25 11:47:29
Your offset time is: 2026-07-25 11:47:29