BulletSim: zero vehicle motion when changing vehicle type.
Rebuild compound linkset of any child in the linkset changes shape. Comments and better detailed logging messages.user_profiles
parent
4042c82a72
commit
5d25bb3084
|
@ -559,9 +559,6 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
break;
|
||||
}
|
||||
|
||||
// Update any physical parameters based on this type.
|
||||
Refresh();
|
||||
|
||||
m_linearMotor = new BSVMotor("LinearMotor", m_linearMotorTimescale,
|
||||
m_linearMotorDecayTimescale, m_linearFrictionTimescale,
|
||||
1f);
|
||||
|
@ -589,6 +586,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
{
|
||||
RegisterForSceneEvents();
|
||||
}
|
||||
|
||||
// Update any physical parameters based on this type.
|
||||
Refresh();
|
||||
}
|
||||
#endregion // Vehicle parameter setting
|
||||
|
||||
|
|
|
@ -246,7 +246,8 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
}
|
||||
|
||||
// Routine called when rebuilding the body of some member of the linkset.
|
||||
// Since we don't keep in world relationships, do nothing unless it's a child changing.
|
||||
// If one of the bodies is being changed, the linkset needs rebuilding.
|
||||
// For instance, a linkset is built and then a mesh asset is read in and the mesh is recreated.
|
||||
// Returns 'true' of something was actually removed and would need restoring
|
||||
// Called at taint-time!!
|
||||
public override bool RemoveDependencies(BSPrimLinkable child)
|
||||
|
@ -256,14 +257,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
DetailLog("{0},BSLinksetCompound.RemoveBodyDependencies,refreshIfChild,rID={1},rBody={2},isRoot={3}",
|
||||
child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody, IsRoot(child));
|
||||
|
||||
if (!IsRoot(child))
|
||||
{
|
||||
child.LinksetInfo = null;
|
||||
}
|
||||
|
||||
// Cannot schedule a refresh/rebuild here because this routine is called when
|
||||
// the linkset is being rebuilt.
|
||||
// InternalRefresh(LinksetRoot);
|
||||
ScheduleRebuild(child);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -322,7 +316,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
// Constraint linksets are rebuilt every time.
|
||||
// Note that this works for rebuilding just the root after a linkset is taken apart.
|
||||
// Called at taint time!!
|
||||
private bool UseBulletSimRootOffsetHack = false;
|
||||
private bool UseBulletSimRootOffsetHack = false; // Attempt to have Bullet track the coords of root compound shape
|
||||
private bool disableCOM = true; // For basic linkset debugging, turn off the center-of-mass setting
|
||||
private void RecomputeLinksetCompound()
|
||||
{
|
||||
|
@ -382,7 +376,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
|||
OMV.Quaternion offsetRot = cPrim.RawOrientation * invRootOrientation;
|
||||
m_physicsScene.PE.AddChildShapeToCompoundShape(linksetShape.physShapeInfo, childShape.physShapeInfo, offsetPos, offsetRot);
|
||||
DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,addChild,indx={1},cShape={2},offPos={3},offRot={4}",
|
||||
LinksetRoot.LocalID, memberIndex, cPrim.PhysShape, offsetPos, offsetRot);
|
||||
LinksetRoot.LocalID, memberIndex, childShape, offsetPos, offsetRot);
|
||||
|
||||
// Since we are borrowing the shape of the child, disable the origional child body
|
||||
if (!IsRoot(cPrim))
|
||||
|
|
|
@ -511,7 +511,7 @@ public class BSPrim : BSPhysObject
|
|||
|
||||
PhysScene.TaintedObject("setVehicleType", delegate()
|
||||
{
|
||||
// Vehicle code changes the parameters for this vehicle type.
|
||||
ZeroMotion(true /* inTaintTime */);
|
||||
VehicleActor.ProcessTypeChange(type);
|
||||
ActivateIfPhysical(false);
|
||||
});
|
||||
|
|
|
@ -182,6 +182,10 @@ public class BSPrimLinkable : BSPrimDisplaced
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: handle collisions of other objects with with children of linkset.
|
||||
// This is a problem for LinksetCompound since the children are packed into the root.
|
||||
|
||||
return base.Collide(collidingWith, collidee, contactPoint, contactNormal, pentrationDepth);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,10 +254,10 @@ public sealed class BSShapeCollection : IDisposable
|
|||
}
|
||||
else
|
||||
{
|
||||
// The current shape on the prim is the correct one. We don't need the potential reference.
|
||||
potentialHull.Dereference(m_physicsScene);
|
||||
}
|
||||
if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,hull,shape={1},key={2}",
|
||||
prim.LocalID, prim.PhysShape, prim.PhysShape.physShapeInfo.shapeKey.ToString("X"));
|
||||
if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,hull,shape={1}", prim.LocalID, prim.PhysShape);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -277,8 +277,7 @@ public sealed class BSShapeCollection : IDisposable
|
|||
// We don't need this reference to the mesh that is already being using.
|
||||
potentialMesh.Dereference(m_physicsScene);
|
||||
}
|
||||
if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,mesh,shape={1},key={2}",
|
||||
prim.LocalID, prim.PhysShape, prim.PhysShape.physShapeInfo.shapeKey.ToString("X"));
|
||||
if (DDetail) DetailLog("{0},BSShapeCollection.CreateGeom,mesh,shape={1}", prim.LocalID, prim.PhysShape);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -352,9 +352,6 @@ public class BSShapeMesh : BSShape
|
|||
float lod;
|
||||
System.UInt64 newMeshKey = BSShape.ComputeShapeKey(prim.Size, prim.BaseShape, out lod);
|
||||
|
||||
physicsScene.DetailLog("{0},BSShapeMesh,getReference,newKey={1},size={2},lod={3}",
|
||||
prim.LocalID, newMeshKey.ToString("X"), prim.Size, lod);
|
||||
|
||||
BSShapeMesh retMesh = null;
|
||||
lock (Meshes)
|
||||
{
|
||||
|
@ -380,6 +377,7 @@ public class BSShapeMesh : BSShape
|
|||
retMesh.physShapeInfo = newShape;
|
||||
}
|
||||
}
|
||||
physicsScene.DetailLog("{0},BSShapeMesh,getReference,mesh={1},size={2},lod={3}", prim.LocalID, retMesh, prim.Size, lod);
|
||||
return retMesh;
|
||||
}
|
||||
public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim)
|
||||
|
@ -507,9 +505,6 @@ public class BSShapeHull : BSShape
|
|||
float lod;
|
||||
System.UInt64 newHullKey = BSShape.ComputeShapeKey(prim.Size, prim.BaseShape, out lod);
|
||||
|
||||
physicsScene.DetailLog("{0},BSShapeHull,getReference,newKey={1},size={2},lod={3}",
|
||||
prim.LocalID, newHullKey.ToString("X"), prim.Size, lod);
|
||||
|
||||
BSShapeHull retHull = null;
|
||||
lock (Hulls)
|
||||
{
|
||||
|
@ -531,10 +526,10 @@ public class BSShapeHull : BSShape
|
|||
// If a mesh was what was created, remember the built shape for later sharing.
|
||||
Hulls.Add(newHullKey, retHull);
|
||||
}
|
||||
|
||||
retHull.physShapeInfo = newShape;
|
||||
}
|
||||
}
|
||||
physicsScene.DetailLog("{0},BSShapeHull,getReference,hull={1},size={2},lod={3}", prim.LocalID, retHull, prim.Size, lod);
|
||||
return retHull;
|
||||
}
|
||||
public override BSShape GetReference(BSScene pPhysicsScene, BSPhysObject pPrim)
|
||||
|
|
Loading…
Reference in New Issue