Archived

This topic is now archived and is closed to further replies.

Dr Pain

Collision example

Recommended Posts

Are there any examples of collision detection for mesh objects that do better than the cylinder check, and work with the landscape engine. I believe polytopes don''t work with the landscape engine, correct? I''ve checked the provided examples, but they seem to be only either polytope checks, BSP checks, or cylinder tests. If it matters, I need to be able to walk through the doorway of a mesh object. Also, projectiles should collide with the mesh itself, rather than the collision cylinder.

Share this post


Link to post
Share on other sites
Well, after reviewing several older posts regarding collision detection, it would seem that what I want is not currently available in PR. Is that correct? I would have to use BSP objects to get the level of collision detection I want.

So a follow-up question. I''ve seen Chris suggest that at most two or three BSP objects exist in a level simultaneously, for performance/memory usage reasons. Does this mean Quake style size BSP objects (entire Quake levels), or any size BSP object? Can I have dozens of BSP objects if they are small (the size of a four room house)?

Also, I haven''t looked into this yet, but can BSP objects be unloaded from memory and new ones loaded dynamically?

Dave

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
What you *could* do is a simple collisoin detection of the bounding sphere or cylinder... then if it hits, check the object itself (either polygon by polygon, or any other method).

Billy

Share this post


Link to post
Share on other sites
Other than BSP collision, PowerRender has REAL crap for collision. I, and others, have requested MULTIPLE times for a more exact collision method, but that has been one thing that Chris refuses to put in with responses similar to "you should not use such exact collision methods". Well, I always thought that I should be the one making those kinds of decisions, but I guess I was wrong.

As for polytopes, they don''t work 99% of the time, and the 1% time it does work its bug-ridden allowing you to get stuck in things and often walk through/fall through surfaces that should be solid. I came to this conclusion by simply taking the "Collide" example and replacing the render mesh and collision mesh with my own which follow all the rules that were set down by the poltope collide thing (collision mesh made up of all convex mesh thingies). I could send you the example if you want, if I were to use collision like that in my game I would be the laughing stock of the gaming community.

Chris!!! Listen up! I know you''re busy with the new PR design, but now that this is like the 99999999''th time this has come up, you gotta do something about it.

I asked Chris about why PRO meshes are so hard to do collide things with and BSPs are so easy. He said it was because BSPs are organized and PRO meshes are jumbled messes of vertex info. I was thinking that there could be some sort of PRO loading function that sorts the information so that we could have accurate collision detection. It would take a lot longer to load that PRO file because of the organization process, but it would only be used for things that need real accurate collision. I bet this could be done. Chris, how about it? We need your input on this.

-Rich

Share this post


Link to post
Share on other sites
PR has lots of collision routines:
polytopes, portal, bsp, triangle intersection, cylinder intersection, etc.

You have to pick the right one depending on the application. Look up Rapid or I-collide for precise polygon collision detection techniques.



Author of Power Render (http:/www.powerrender.com)

Share this post


Link to post
Share on other sites
I know chris is wary of putting in more complex collision routines for fear that people will overuse them and think it''s just that Power Render is slow.

I like the idea of having an organized pro file that could handle collision detection easily. ProEdit could even save the pro in an orginized form so the pro could still be loaded rather quickly.

I''ve used Power Render for a while now and the one thing that has always disapointed me was the collision system. Sure, it is possible and I''ve used the PR methods to get pretty good collision detection before, but the collision section of Power Render often seems like a bunch of random collision routines tossed together. The BSP collision is nice, but since a large part of Power Render is its use of Pro Objects, the collision code is really lacking.

If chris could store some collision information (nicely calculated in ProEdit), he could make a routine like PRCL_RayIntersectsEntity or PRCL_EntityIntersectsEntity. This could do a bounding sphere check and do more advanced collision detection as nessisary. This would nicely wrap up the collision system.

As it is, I''ve often created my own collision routines to accomplish better results.
One resource I''ve used that seemed pretty good was:
http://www.magic-software.com/Documentation/MethodOfSeparatingAxes.pdf

Which covers convex polygon to convex polygon collision detection and even gives example source code and pictures to help explain. There is code which covers triangle to triangle intersection (optimized a little over the convex polygon version). Dr Pain, you may want to look at that, since everything in PR is triangles. Just keep in mind not to over use it


Gary


Share this post


Link to post
Share on other sites
Thanks Gary. I have in fact already been using that link. I can use that method to do collision with bounding boxes, but when it comes to the polygon detection, I don''t think it will help.

And Chris, as for Rapid or I-collide, I already have my data in quadtrees and can very quickly and efficiently determine when two bounding boxes overlap. I need to now take it to the next level of detail to determine the if the two meshes actually collide (not just their bounding boxes).

If it matters, at this point I don''t care about the point of contact, but rather just a boolean DOES_COLLIDE or DOESNT_COLLIDE will do.

But anyway, I don''t have a problem using small BSP objects if the engine can handle multitudes of them. Can it Chris? I haven''t tried it myself yet. Perhaps tonight.

Share this post


Link to post
Share on other sites
Have you looked at the TrianglePick example? This could be modified to return the closest triangle intersecting with a ray in 3D space.

Instead of transforming to view space and tracking the closest z value, transform the object to world space and keep track of the lowest intersection value (t).



Author of Power Render (http:/www.powerrender.com)

Share this post


Link to post
Share on other sites
Chris, can you please respond on the matter of "organized" pro files that allow for advacned collision like BSPs. You said that is the main difference. That BSPs are organized and PRO files are not. Please comment about putting in a feature into either PRO edit or the engine that allows the PRO mesh to be "compiled" into a organized format for collision purposes. Please respond.

-Rich

Share this post


Link to post
Share on other sites
What kind of ''organization''? Why not just use BSP''s in the first place?

If you split your PRO object into segments you can do quicker bounding box checks on each segment before you check every triangle. The other possibilities for organization would be BSP, or Octrees.

Doing exact collision on every triangle like this will defeat the purpose of hardware T&L, since you will need to transform the object to world space on the CPU! This is why I do not recommend per triangle checking and prefer simpler representations like polytopes, spheres, boxes or cylinders.




Author of Power Render (http:/www.powerrender.com)

Share this post


Link to post
Share on other sites
Dr Pain,

You should be able to use the method of separating axes on the 3D triangle that is made up by the vertices of each face (these need to be in world space). Then just compare the faces in one segement with the faces in the other segment to get exact collision accuracy.


Gary

Share this post


Link to post
Share on other sites