mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 04:05:42 +08:00
BulletSim: make avatar physical shape to be a rectangle rather than
a capsule. Set the default to be the rectangle shape and adjust the parameters in OpenSimDefaults.ini for the new shape. The rectangle shape will perform better and avatar height can be computed more accurately.
This commit is contained in:
@@ -124,6 +124,10 @@ public sealed class BSShapeCollection : IDisposable
|
||||
// Info in prim.BSShape is updated to the new shape.
|
||||
// Returns 'true' if the geometry was rebuilt.
|
||||
// Called at taint-time!
|
||||
public const int AvatarShapeCapsule = 0;
|
||||
public const int AvatarShapeCube = 1;
|
||||
public const int AvatarShapeOvoid = 2;
|
||||
public const int AvatarShapeMesh = 3;
|
||||
private bool CreateGeom(bool forceRebuild, BSPhysObject prim, PhysicalDestructionCallback shapeCallback)
|
||||
{
|
||||
bool ret = false;
|
||||
@@ -137,10 +141,32 @@ public sealed class BSShapeCollection : IDisposable
|
||||
if (theChar != null)
|
||||
{
|
||||
DereferenceExistingShape(prim, shapeCallback);
|
||||
prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim,
|
||||
switch (BSParam.AvatarShape)
|
||||
{
|
||||
case AvatarShapeCapsule:
|
||||
prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim,
|
||||
BSPhysicsShapeType.SHAPE_CAPSULE, FixedShapeKey.KEY_CAPSULE);
|
||||
ret = true;
|
||||
haveShape = true;
|
||||
ret = true;
|
||||
haveShape = true;
|
||||
break;
|
||||
case AvatarShapeCube:
|
||||
prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim,
|
||||
BSPhysicsShapeType.SHAPE_BOX, FixedShapeKey.KEY_CAPSULE);
|
||||
ret = true;
|
||||
haveShape = true;
|
||||
break;
|
||||
case AvatarShapeOvoid:
|
||||
// Saddly, Bullet doesn't scale spheres so this doesn't work as an avatar shape
|
||||
prim.PhysShape = BSShapeNative.GetReference(m_physicsScene, prim,
|
||||
BSPhysicsShapeType.SHAPE_SPHERE, FixedShapeKey.KEY_CAPSULE);
|
||||
ret = true;
|
||||
haveShape = true;
|
||||
break;
|
||||
case AvatarShapeMesh:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the prim attributes are simple, this could be a simple Bullet native shape
|
||||
|
||||
Reference in New Issue
Block a user