Share

SPRING Surgical Simulator

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

Found an old bug...

You are viewing a single message from this topic. View all messages.

  1. 2009-03-12 00:14:44 UTC
    Hi Folks,
    I'm the main culprit responsible for Spring, but I'm thrilled for the other 2500 or so folks that have (hopefully) benefitted from taking a look at the source and leveraging it for their own simulators.

    But I did want to point out one bug that we found today that has been bugging me (pun intended) for literally years.

    In the code, you'll see that we used Bounding Spheres as the collision detection method. In theory, this should be fast. But in practicality, it's pretty slow and you'd be better off with AABBs or, even better, my SBB code which was commented out. Anyway, there were some political reasons for being stuck with BSPs that no longer apply, but there was a ramification to all that, which is below.

    Because BSP trees were so slow, I believe that we'd put the collision detection in the graphics thread, the idea being that we'd detect the collision there, but then the haptics thread would handle it and do the haptics at a much faster (8000+) update rate. Well, I was always bothered about the feel on the initial contact- in short, it felt bouncy (although it was fine if you were in continuous contact) and not right and this bugged me for years. Today I found out why.

    Basically, since the collision detection is happening in the graphics thread (let's say 20fps), it wont detect that initial collision until 1/20th of a second later and, when it does, you're already penetrated through the surface quite a ways. So that's where that bounce would come from. If you were in continuous contact, then the collision detection didnt matter- it already had it. But that initial contact would really give an unrealistic kick, especially if the forces were high. Similarly, when you lose contact with the surface, it would take too long to break that collision out of the list, but this was less of an issue, since we wrote the haptics code to ensure that the depth of penetration had to be positive.

    Anyway, please save yourself the hassle and put the collision detection back into the haptics thread and/or (even better), put it in its own thread...
    Thanks!!
    -Kevin
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.