In Chapter 8 of Dave Eberly's 3D Game Engine Design, where is the rest of Colliders?

Started by
5 comments, last by Steve_Segreto 14 years ago
Section 8.3 starts off describing a nice abstract base class called Colliders around page 455, but never describes several of the methods in any detail. I looked at both the WildMagic 4.0 and 4.10 engine source code and never could find source code for either this class or any of its derived classes. It would be interesting to see this class implemented in its entirety, along with a SphereCollider derived class implementation, especially for the ComputeContactInformation() method of the SphereCollider.
Advertisement
The Morgan Kaufmann Series is extreamly good, but no one book will tell you evertyhing. In addition to what you have, I would also check out:

GAME PHYSICS Engine Design - good descriptions on collision response.
Real Time Collision Detection - good for determining collision of complex shape
Essential Mathmatics for Game and Interactive~~ -really good all around collision math (and alot more)

It sucks the one book is'nt good at this, but it is a very complex subject. I had to intesivly pour over all three books before I could get this working.




Section 8.2 has many of the details for the pseudocode in section 8.3, but section 8.3 also has some details. It is not clear what you mean by "never describes several of the methods in any detail."

The pseudocode framework is implemented in Wm4Distance.{h,cpp}, although I do not have explicit code for distance calculations for moving spheres (in the Distance-like classes). However, Wm5IntrSphere3Sphere3::Find(Real,...) implements the algorithm for ComputeContactInformation for moving spheres. It should be simple enough to move this into new files Wm4DistSphere3Sphere3.{h,cpp} so that the Wm4Distance framework will use it.
Thanks everybody for the replies.

Mr. Eberly, it seems that the abstract class with the exact name Colliders is not present in Wild Magic source code and neither are any derived classes (like SphereCollider). This was just confusing to me as I expected it to be in the engine with the exact name and set of function prototypes as in the book.

The Wm4Distance.cpp does have a templated class that seems to encapsulate a similar Newton's method for comparing intervals, but it is complicated by all the template code, and doesn't have exactly the same interface as the original Colliders abstract base class, nor does it use the nice CollisionType enum you describe in the book.

Also the Wm4IntrSphere3Sphere3.cpp/h class is derived from Intersector class which doesn't really have an easy relationship to the Distance class.

Just my two cents, I've already bought the book, but I would suggest that on future books you should discuss the code you provide on your CD not just random partial non-buildable code (the printed code for the Colliders class has a compiler error on page 459 of the second edition of 3DGED on the line that reads "float fT0 -= fF0/fFDer0;")

That being said I have a great deal of respect for what you know and what you could teach others, but I have a hard time learning without a small usable class that I can pull out and try in my own codebase, and that was my hope for the Colliders abstract base class.
Damn, props to Eberly for showing up on this post. That's what I call an author.
Quote:Original post by Steve_Segreto
... but it is complicated by all the template code...


The only template parameter is "Real" and resolves to either "float" or "double". I do not understand why you believe that is complicated.

Quote:
Just my two cents, I've already bought the book, but I would suggest that on future books you should discuss the code you provide on your CD not just random partial non-buildable code (the printed code for the Colliders class has a compiler error on page 459 of the second edition of 3DGED on the line that reads "float fT0 -= fF0/fFDer0;")


Pseudocode is called that because it is supposed to illustrate ideas, not to be something you can simply cut-and-paste and have it compile. The pseudocode you refer to is not random. It is designed to be a bridge between (1) the pictures I drew of a convex function for which you want to know its smallest positive root and (2) an actual real-life compilable application. I believe there is enough information in sections 8.2 and 8.3 for anyone willing to work at it to produce a source code implementation. What you appear to want instead is a commercial software package that you can plug into your applications without thinking about it.

Regarding your advice on future books. My source code contains approximately 300,000 lines of code. If you print 60 lines per page, a full printing of the source code alone would require 5000 pages. That makes it practically impossible to have a Literate Programming style that describes everything about the source code that ships with the book. I am sorry that you found the book not to your liking, but I doubt that my style of presentation will change much on future books.

At any rate, here is a simple implementation that started with the pseudocode. I had to make a few minor modifications, but that is to be expected when starting with pseudocode. SphereColliders.zip

Thank you very much Mr. Eberly. To anyone else reading this post, the book I was talking about is a huge book and has many many helpful chapters and overall is a good addition to my library.

This topic is closed to new replies.

Advertisement