BulletSim: tweeking avatar capsule code in an attempt to have

asymmetrical avatar capsule work now that rotation is being passed
from the simulator. Turns out the Bullet capsule is just not very
functional: it doesn't scale properly, the implementation only half
does asymmetry and, in general, is hard to work with.
Avatar shape is about what it was before these changes.
Added initial data structures for avatar shape mesh.
This commit is contained in:
Robert Adams
2012-12-29 08:03:57 -08:00
parent 976023366f
commit db6c0363f0
4 changed files with 81 additions and 46 deletions

View File

@@ -420,8 +420,7 @@ public sealed class BSShapeCollection : IDisposable
if (!haveShape && prim.PreferredPhysicalShape == BSPhysicsShapeType.SHAPE_CAPSULE)
{
// an avatar capsule is close to a native shape (it is not shared)
GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_CAPSULE,
FixedShapeKey.KEY_CAPSULE, shapeCallback);
GetReferenceToNativeShape(prim, BSPhysicsShapeType.SHAPE_CAPSULE, FixedShapeKey.KEY_CAPSULE, shapeCallback);
if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape);
ret = true;
haveShape = true;
@@ -573,6 +572,9 @@ public sealed class BSShapeCollection : IDisposable
{
// The proper scale has been calculated in the prim.
newShape = new BulletShape(
// Bullet's capsule total height is the passed "height + (radius * 2)" so, the base
// capsule is radius of 0.5f (1 diameter) and height of two (1.0f + 0.5f * 2)".
// This must be taken into account when computing the scaling of the capsule.
BulletSimAPI.BuildCapsuleShape2(PhysicsScene.World.ptr, 1f, 1f, prim.Scale)
, shapeType);
if (DDetail) DetailLog("{0},BSShapeCollection.BuiletPhysicalNativeShape,capsule,scale={1}", prim.LocalID, prim.Scale);