BulletSim: center-of-gravity linkset changes. Not working yet.

Conflicts:

	OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
user_profiles
Robert Adams 2013-01-23 09:09:17 -08:00
parent c1371ab786
commit a5e9c665f0
4 changed files with 9 additions and 29 deletions

View File

@ -407,6 +407,9 @@ public sealed class BSLinksetCompound : BSLinkset
// Since we're displacing the center of the shape, we need to move the body in the world // Since we're displacing the center of the shape, we need to move the body in the world
LinksetRoot.PositionDisplacement = centerDisplacement; LinksetRoot.PositionDisplacement = centerDisplacement;
// This causes the root prim position to be set properly based on the new PositionDisplacement
LinksetRoot.ForcePosition = LinksetRoot.RawPosition;
// Update the local transform for the root child shape so it is offset from the <0,0,0> which is COM
PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, 0, -centerDisplacement, OMV.Quaternion.Identity, false); PhysicsScene.PE.UpdateChildTransform(LinksetRoot.PhysShape, 0, -centerDisplacement, OMV.Quaternion.Identity, false);
DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,com={1},rootPos={2},centerDisp={3}", DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,COM,com={1},rootPos={2},centerDisp={3}",
LinksetRoot.LocalID, centerOfMass, LinksetRoot.RawPosition, centerDisplacement); LinksetRoot.LocalID, centerOfMass, LinksetRoot.RawPosition, centerDisplacement);
@ -438,7 +441,7 @@ public sealed class BSLinksetCompound : BSLinkset
if (cPrim.PhysShape.isNativeShape) if (cPrim.PhysShape.isNativeShape)
{ {
// A native shape is turning into a hull collision shape because native // A native shape is turned into a hull collision shape because native
// shapes are not shared so we have to hullify it so it will be tracked // shapes are not shared so we have to hullify it so it will be tracked
// and freed at the correct time. This also solves the scaling problem // and freed at the correct time. This also solves the scaling problem
// (native shapes scaled but hull/meshes are assumed to not be). // (native shapes scaled but hull/meshes are assumed to not be).

View File

@ -645,11 +645,8 @@ public static class BSParam
entries.Add(new PhysParameterEntry(pd.name, pd.desc)); entries.Add(new PhysParameterEntry(pd.name, pd.desc));
} }
// make the list in alphabetical order for estetic reasons // make the list alphabetical for estetic reasons
entries.Sort(delegate(PhysParameterEntry ppe1, PhysParameterEntry ppe2) entries.Sort((ppe1, ppe2) => { return ppe1.name.CompareTo(ppe2.name); });
{
return ppe1.name.CompareTo(ppe2.name);
});
SettableParameters = entries.ToArray(); SettableParameters = entries.ToArray();
} }

View File

@ -322,6 +322,7 @@ public sealed class BSPrim : BSPhysObject
}); });
} }
} }
public override OMV.Vector3 ForcePosition { public override OMV.Vector3 ForcePosition {
get { get {
_position = PhysicsScene.PE.GetPosition(PhysBody) - PositionDisplacement; _position = PhysicsScene.PE.GetPosition(PhysBody) - PositionDisplacement;
@ -336,27 +337,6 @@ public sealed class BSPrim : BSPhysObject
} }
} }
} }
/* Disable. Presume whoever is setting displacement is already adjusting position, etc.
// Override to have position displacement immediately update the physical position.
// A feeble attempt to keep the sim and physical positions in sync
// Must be called at taint time.
public override OMV.Vector3 PositionDisplacement
{
get
{
return base.PositionDisplacement;
}
set
{
base.PositionDisplacement = value;
PhysicsScene.TaintedObject(PhysicsScene.InTaintTime, "BSPrim.setPosition", delegate()
{
if (PhysBody.HasPhysicalBody)
PhysicsScene.PE.SetTranslation(PhysBody, _position + base.PositionDisplacement, _orientation);
});
}
}
*/
// Check that the current position is sane and, if not, modify the position to make it so. // Check that the current position is sane and, if not, modify the position to make it so.
// Check for being below terrain and being out of bounds. // Check for being below terrain and being out of bounds.

View File

@ -708,8 +708,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
// TriggerPreStepEvent // TriggerPreStepEvent
// DoOneTimeTaints // DoOneTimeTaints
// Step() // Step()
// ProcessAndForwardCollisions // ProcessAndSendToSimulatorCollisions
// ProcessAndForwardPropertyUpdates // ProcessAndSendToSimulatorPropertyUpdates
// TriggerPostStepEvent // TriggerPostStepEvent
// Calls to the PhysicsActors can't directly call into the physics engine // Calls to the PhysicsActors can't directly call into the physics engine