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 / Intersection Problem - Limbs

Author
Message
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 2nd Jul 2005 12:44
Im trying to have my intersection rays avoid looking for intersection between limbs.

I have these limbs on a basic object, the problem is the limbs are just for cosmetic purposes and aren't supposed to be detected for intersection with other objects, but DBP treats objects and their limbs as one object.

I dont think I should need to supply some code since all Im looking for is a command, I checked the help files on everything relating limbs and couldnt find anything.

Thanks in advance, if you need some code just ask.


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 3rd Jul 2005 02:30 Edited at: 3rd Jul 2005 02:33
There are two ways to go about looking for collision when using rays. From the source object or from the external object. Let's call a player the source object. And let's call a .x terrain our external object. If we detect from the source object, our player can interact with the terrain in a very specific manner; i.e. sliding along walls, fitting into corners, getting stuck in a narrow place, climbing stairs, etc. The problem is that, let's say there is a waterfall on your terrain and you want your player to go through it - naturally. The waterfall counts as a limb, which counts a part of the terrain object, and therefore your player cannot walk through it.

But there is another way to approch collision detection, and to make this work properly requires a sort of coding prestidigitation. You can use the limbs of the terrain object to cast rays to detect collision of the player. This is not an easy task by any means, but it will allow you to 'skip' that waterfall and allow the player to pass right on through.

You start with the 5.8 vertex commands to get the verticies of the limb to detect collision from. Use the verticies to cast rays to the boundries of the limb (I typically go from the limb center to the verticies, but you can go from vertex to vertex as well. Then, if the there is a collision, you can use vector commands to interpolate the exact point of collision. From that point, you 'push' the player a given distance (typically the player_size - impact_distance) away from the wall. I personally use an averaging system to calulate an average distance away from all collision points so as to prevent/reduce a vibrating effect.

The trick to managing this inverted collision system is several fold.
1) Detecting all limbs all the time would literally halt any pc. So you have to turn limb collision on/off as the player get's near or moves away from the limb. It should be okay to turn a few limbs at the same time.
2) Detecting all the verticies all the time for even one limb will grind most pc's to a halt, and the remaining few will crawl. So you have to add in an accuracy setting that skips verticies. I use that and an offset that changes each frame. Then I keep the average from the previous frame collision detection and factor in the current frame's collision detection plus any movement from the object. I do this for about 3-5 frames (at 60 FPS, it's about 1/12 of a second) and then reset everything. You get smooth, fairly accurate collision and a decent frame-rate.
3) Fine tuning. Once you have everything down, you will need to fine-tune the settings to balance frame-rate, accuracy, and smoothness (minimal vibration).

Take a look at the DBPro coding challenges at the current challenge, which is a robot-hand challenge. I am using this techinique to effectively lift a ball with a robot hand. I am still working out the details, but it's more than a decent start.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 3rd Jul 2005 11:05
Who said this was about collision o.O

I already figured out collision with intersection rays,

Either way I solved me problem. Thanks anyways Riidii.


Current Projects: SHADE - Game Maker | Mecho - TGC Puzzle Entry | Halo Physics Engine | COLD - Polygonal Collision Detection

Login to post a reply

Server time is: 2024-11-27 22:37:02
Your offset time is: 2024-11-27 22:37:02