For some time people have been fighting with getting roads to work well in Second Life. The subject came up again this week. Andrew Linden gave us some information that may help some work around the problem:
It [the road seam bounce] is a really hard problem to fix… it is a basic quirk of the physics engine. It might be fixable with careful content workarounds, but it is very hard for us to fix by tweaking vehicles any further.
I don’t know the best way to work-around the seam jump. I’m guessing that you could add a “transition slope” at the edge of the roads pieces that drop down, and overlap the meshes there.
What happens is that the physics engine will produce collision points between the car and some surfaces that are “behind” others … if they are on distinct objects.
Suppose you took several distinct objects and stacked them such that you had a series of flat surfaces stacked very close to each other… an object rolling or sliding on that stack of surfaces will actually collide with many of the objects, not just the top one. The assumption here being that the surfaces are stacked so that they are all within about 0.05 m from the moving object.
Theresa Tennyson: So, in other words, the car thinks it’s running into the ends of the pavement slabs?
Yes, in the Havok physics engine collision points are generated when objects are proximate, not actually “touching”. Think of the contact points as little “ball bearings”… they are created when two objects are close to each other. They don’t act like actual colliding balls, but they do contain info (collision normal, collision distance, friction, etc) about the contact point and the persist as long as the objects are within some distance to each other.
I think there is some logic in the physics engine such that when lots of collision points are created near the same spot (such as colliding with 10 distinct objects at the same small region of space) some contact points are discarded as duplicates. However, contact points that are NOT duplicates (with a very different collision normal, for example) would survive such a culling pass. So, as the car slides over the object seam, a contact point may be created for the “vertical” face that is hidden under the seam because the contact points are created when the two colliding objects are proximate, but not necessarily touching.
Do any of you remember the gap between stacked dynamic boxes that used to be visible in SL?
This stack of boxes used to have a 0.1m gap between them. They still do actually. However, the collision shape we give them is slightly smaller than the visible shape, which makes them appear to actually touch.
The Havok physics engine tries very hard to keep the objects apart — they all have a 0.05 m “collision radius”, so they actually collide with an expanded surface that is within 0.05 m of their own expanded surface. The reason Havok does this is that computing the collision points when the objects are in a penetration state is much more expensive than when they are not overlapping. So they just work very hard to keep the objects from penetrating in the first place.
So… if you have two objects you’re using for road prims and you butt them up visually… there is an effective 0.1m collision gap between them that you cannot see. Even if you overlap them by 0.1m… an object sliding across the top can still collide with the vertical face hidden below the top surfaces because the sliding object’s “convex radius” surface has only to get within 0.05 m of the road’s corresponding surface for its vertical face. And you end up with a contact point that has a non-vertical collision normal.
I had not heard the Havok collision information explained in this level of detail before. I think it is interesting. Hopefully it will help someone.