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.

DLL Talk / sparky's collision question

Author
Message
Emphasoft
17
Years of Service
User Offline
Joined: 2nd Jun 2007
Location: Deep Underneath the Center of the Earth
Posted: 31st Aug 2007 18:44
Hi, I have a question regarding the spherecast command: Can it be used to create a sphere around a point in space, which returns the object number of any object that enters the sphere? Thanks.

Why fight when you can negotiate?
-Jack Sparrow
Emphasoft
17
Years of Service
User Offline
Joined: 2nd Jun 2007
Location: Deep Underneath the Center of the Earth
Posted: 1st Sep 2007 14:26
perhaps I should clarify. If I were to use the spherecast to check the closest object within a certain distance (say,50 units),how would I go about doing that. The way the helpfile documents it doesn't make sense.

Why fight when you can negotiate?
-Jack Sparrow
Emphasoft
17
Years of Service
User Offline
Joined: 2nd Jun 2007
Location: Deep Underneath the Center of the Earth
Posted: 16th Sep 2007 23:21
*bump* Why do I have 70 views, but no replies? Could someone at least give me an alternative?

Why fight when you can negotiate?
-Jack Sparrow
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 20th Sep 2007 16:51
Dude... Relax - this forum is less "perused".

Quote: "Can it be used to create a sphere around a point in space, which returns the object number of any object that enters the sphere? Thanks."


I don't know. But I do know you could make and invisible sphere and set it up for collision - and then get the object # of the last collision and the X,Y,Z also. There is the possibility of "skip" though where the object is outside - and next position is inside. That will get ignored. On trick I use which isn't perfect but pretty decent - is if I have a fast mover - and the timing suggests moving it "100", I'll divide that value I need to move it by like 10 and just move it in steps checking for collision each spin. (This isn't an onscreen/sync - its a quick "object move" but in tiny pieces to make better chance of hitting the object I'd like it to register. You also can cheat this with invisible object that is "oversized" (Like bullets are obviously tiny - but I've sometimes made invisible JAVELINS just to decrease the chance of "skip". (where the collision doesn't register.)

For the distance thing - make a vector...



then use


The vector way is faster. I've tested it against the square root math method.

But I'm always hering "Use a grid" to minimize searching. This means - only check the distance of the "objects" you suspect a collision with that are "within" the resonable x/y/z range of your sphere... like X>min and X<max and Y>min and y<max and Z>min and Z<max (For example) because in short - you want to check as few objects as possible. Looping is slow in DPRO.

Ray Casting works pretty good... and is Sphere Cast works like Ray Cast - than this would probably be WAY faster - but You'll likely need to set up a little test app to try it out seeing how no one has responded to you prior to me.

Login to post a reply

Server time is: 2024-11-22 22:30:12
Your offset time is: 2024-11-22 22:30:12