Revert "Revert "BulletSim: freshen up the code for constraint based linksets.""
Found that the vehicle movement problem was not caused by these physics changes.
This reverts commit 44543ebe63
.
TeleportWork
parent
90528c23d9
commit
af9deed135
|
@ -1029,8 +1029,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
// Add this correction to the velocity to make it faster/slower.
|
// Add this correction to the velocity to make it faster/slower.
|
||||||
VehicleVelocity += linearMotorVelocityW;
|
VehicleVelocity += linearMotorVelocityW;
|
||||||
|
|
||||||
VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}",
|
VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},tgt={3},correctV={4},correctW={5},newVelW={6},fricFact={7}",
|
||||||
ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV,
|
ControllingPrim.LocalID, origVelW, currentVelV, m_linearMotor.TargetValue, linearMotorCorrectionV,
|
||||||
linearMotorVelocityW, VehicleVelocity, frictionFactorV);
|
linearMotorVelocityW, VehicleVelocity, frictionFactorV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ public sealed class BSLinksetCompound : BSLinkset
|
||||||
{
|
{
|
||||||
DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}",
|
DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}",
|
||||||
requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren));
|
requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren));
|
||||||
|
|
||||||
// When rebuilding, it is possible to set properties that would normally require a rebuild.
|
// When rebuilding, it is possible to set properties that would normally require a rebuild.
|
||||||
// If already rebuilding, don't request another rebuild.
|
// If already rebuilding, don't request another rebuild.
|
||||||
// If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding.
|
// If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding.
|
||||||
|
|
|
@ -48,12 +48,22 @@ public sealed class BSLinksetConstraints : BSLinkset
|
||||||
{
|
{
|
||||||
base.Refresh(requestor);
|
base.Refresh(requestor);
|
||||||
|
|
||||||
if (HasAnyChildren && IsRoot(requestor))
|
}
|
||||||
|
|
||||||
|
private void ScheduleRebuild(BSPrimLinkable requestor)
|
||||||
|
{
|
||||||
|
DetailLog("{0},BSLinksetConstraint.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}",
|
||||||
|
requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren));
|
||||||
|
|
||||||
|
// When rebuilding, it is possible to set properties that would normally require a rebuild.
|
||||||
|
// If already rebuilding, don't request another rebuild.
|
||||||
|
// If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding.
|
||||||
|
if (!Rebuilding && HasAnyChildren)
|
||||||
{
|
{
|
||||||
// Queue to happen after all the other taint processing
|
// Queue to happen after all the other taint processing
|
||||||
m_physicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate()
|
m_physicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate()
|
||||||
{
|
{
|
||||||
if (HasAnyChildren && IsRoot(requestor))
|
if (HasAnyChildren)
|
||||||
RecomputeLinksetConstraints();
|
RecomputeLinksetConstraints();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -67,8 +77,14 @@ public sealed class BSLinksetConstraints : BSLinkset
|
||||||
// Called at taint-time!
|
// Called at taint-time!
|
||||||
public override bool MakeDynamic(BSPrimLinkable child)
|
public override bool MakeDynamic(BSPrimLinkable child)
|
||||||
{
|
{
|
||||||
// What is done for each object in BSPrim is what we want.
|
bool ret = false;
|
||||||
return false;
|
DetailLog("{0},BSLinksetConstraints.MakeDynamic,call,IsRoot={1}", child.LocalID, IsRoot(child));
|
||||||
|
if (IsRoot(child))
|
||||||
|
{
|
||||||
|
// The root is going dynamic. Rebuild the linkset so parts and mass get computed properly.
|
||||||
|
ScheduleRebuild(LinksetRoot);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The object is going static (non-physical). Do any setup necessary for a static linkset.
|
// The object is going static (non-physical). Do any setup necessary for a static linkset.
|
||||||
|
@ -78,8 +94,16 @@ public sealed class BSLinksetConstraints : BSLinkset
|
||||||
// Called at taint-time!
|
// Called at taint-time!
|
||||||
public override bool MakeStatic(BSPrimLinkable child)
|
public override bool MakeStatic(BSPrimLinkable child)
|
||||||
{
|
{
|
||||||
// What is done for each object in BSPrim is what we want.
|
bool ret = false;
|
||||||
return false;
|
|
||||||
|
DetailLog("{0},BSLinksetConstraint.MakeStatic,call,IsRoot={1}", child.LocalID, IsRoot(child));
|
||||||
|
child.ClearDisplacement();
|
||||||
|
if (IsRoot(child))
|
||||||
|
{
|
||||||
|
// Schedule a rebuild to verify that the root shape is set to the real shape.
|
||||||
|
ScheduleRebuild(LinksetRoot);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called at taint-time!!
|
// Called at taint-time!!
|
||||||
|
@ -105,7 +129,7 @@ public sealed class BSLinksetConstraints : BSLinkset
|
||||||
// Just undo all the constraints for this linkset. Rebuild at the end of the step.
|
// Just undo all the constraints for this linkset. Rebuild at the end of the step.
|
||||||
ret = PhysicallyUnlinkAllChildrenFromRoot(LinksetRoot);
|
ret = PhysicallyUnlinkAllChildrenFromRoot(LinksetRoot);
|
||||||
// Cause the constraints, et al to be rebuilt before the next simulation step.
|
// Cause the constraints, et al to be rebuilt before the next simulation step.
|
||||||
Refresh(LinksetRoot);
|
ScheduleRebuild(LinksetRoot);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +147,7 @@ public sealed class BSLinksetConstraints : BSLinkset
|
||||||
DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
|
DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
|
||||||
|
|
||||||
// Cause constraints and assorted properties to be recomputed before the next simulation step.
|
// Cause constraints and assorted properties to be recomputed before the next simulation step.
|
||||||
Refresh(LinksetRoot);
|
ScheduleRebuild(LinksetRoot);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +171,7 @@ public sealed class BSLinksetConstraints : BSLinkset
|
||||||
PhysicallyUnlinkAChildFromRoot(rootx, childx);
|
PhysicallyUnlinkAChildFromRoot(rootx, childx);
|
||||||
});
|
});
|
||||||
// See that the linkset parameters are recomputed at the end of the taint time.
|
// See that the linkset parameters are recomputed at the end of the taint time.
|
||||||
Refresh(LinksetRoot);
|
ScheduleRebuild(LinksetRoot);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -165,6 +189,7 @@ public sealed class BSLinksetConstraints : BSLinkset
|
||||||
Refresh(rootPrim);
|
Refresh(rootPrim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a static constraint between the two passed objects
|
||||||
private BSConstraint BuildConstraint(BSPrimLinkable rootPrim, BSPrimLinkable childPrim)
|
private BSConstraint BuildConstraint(BSPrimLinkable rootPrim, BSPrimLinkable childPrim)
|
||||||
{
|
{
|
||||||
// Zero motion for children so they don't interpolate
|
// Zero motion for children so they don't interpolate
|
||||||
|
@ -281,6 +306,17 @@ public sealed class BSLinksetConstraints : BSLinkset
|
||||||
DetailLog("{0},BSLinksetConstraint.RecomputeLinksetConstraints,set,rBody={1},linksetMass={2}",
|
DetailLog("{0},BSLinksetConstraint.RecomputeLinksetConstraints,set,rBody={1},linksetMass={2}",
|
||||||
LinksetRoot.LocalID, LinksetRoot.PhysBody.AddrString, linksetMass);
|
LinksetRoot.LocalID, LinksetRoot.PhysBody.AddrString, linksetMass);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Rebuilding = true;
|
||||||
|
|
||||||
|
// There is no reason to build all this physical stuff for a non-physical linkset.
|
||||||
|
if (!LinksetRoot.IsPhysicallyActive)
|
||||||
|
{
|
||||||
|
DetailLog("{0},BSLinksetConstraint.RecomputeLinksetCompound,notPhysical", LinksetRoot.LocalID);
|
||||||
|
return; // Note the 'finally' clause at the botton which will get executed.
|
||||||
|
}
|
||||||
|
|
||||||
foreach (BSPrimLinkable child in m_children)
|
foreach (BSPrimLinkable child in m_children)
|
||||||
{
|
{
|
||||||
// A child in the linkset physically shows the mass of the whole linkset.
|
// A child in the linkset physically shows the mass of the whole linkset.
|
||||||
|
@ -298,7 +334,11 @@ public sealed class BSLinksetConstraints : BSLinkset
|
||||||
|
|
||||||
// PhysicsScene.PE.DumpConstraint(PhysicsScene.World, constrain.Constraint); // DEBUG DEBUG
|
// PhysicsScene.PE.DumpConstraint(PhysicsScene.World, constrain.Constraint); // DEBUG DEBUG
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Rebuilding = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue