BulletSim: rip out old code for linkset child position fetching. BulletSim doesn't need to do that bookkeeping because SOG/SOP already does it.

0.7.5-pf-bulletsim
Robert Adams 2012-12-14 17:03:59 -08:00
parent 1a262bdde7
commit ace1f1e931
5 changed files with 31 additions and 45 deletions

View File

@ -38,6 +38,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// Each type of linkset will define the information needed for its type.
public abstract class BSLinksetInfo
{
public virtual void Clear() { }
}
public abstract class BSLinkset
@ -95,13 +96,6 @@ public abstract class BSLinkset
return BSPhysicsShapeType.SHAPE_UNKNOWN;
}
// Linksets move around the children so the linkset might need to compute the child position
public virtual OMV.Vector3 Position(BSPhysObject member)
{ return member.RawPosition; }
public virtual OMV.Quaternion Orientation(BSPhysObject member)
{ return member.RawOrientation; }
// TODO: does this need to be done for Velocity and RotationalVelocityy?
// We keep the prim's mass in the linkset structure since it could be dependent on other prims
protected float m_mass;
public float LinksetMass

View File

@ -45,6 +45,11 @@ sealed class BSLinksetCompoundInfo : BSLinksetInfo
OffsetPos = p;
OffsetRot = r;
}
public override void Clear()
{
OffsetPos = OMV.Vector3.Zero;
OffsetRot = OMV.Quaternion.Identity;
}
public override string ToString()
{
StringBuilder buff = new StringBuilder();
@ -82,8 +87,11 @@ public sealed class BSLinksetCompound : BSLinkset
// its internal properties.
public override void Refresh(BSPhysObject requestor)
{
// External request for Refresh (from BSPrim) doesn't need to do anything
// InternalRefresh(requestor);
if (!IsRoot(requestor))
{
}
// Something changed so do the rebuilding thing
InternalRefresh(requestor);
}
// Schedule a refresh to happen after all the other taint processing.
@ -170,18 +178,6 @@ public sealed class BSLinksetCompound : BSLinkset
// Nothing to do for compound linksets on property updates
}
// The children move around in relationship to the root.
// Just grab the current values of wherever it is right now.
public override OMV.Vector3 Position(BSPhysObject member)
{
return BulletSimAPI.GetPosition2(member.PhysBody.ptr);
}
public override OMV.Quaternion Orientation(BSPhysObject member)
{
return BulletSimAPI.GetOrientation2(member.PhysBody.ptr);
}
// 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.
// Returns 'true' of something was actually removed and would need restoring

View File

@ -83,18 +83,6 @@ public sealed class BSLinksetConstraints : BSLinkset
// Nothing to do for constraints on property updates
}
// The children of the linkset are moved around by the constraints.
// Just grab the current values of wherever it is right now.
public override OMV.Vector3 Position(BSPhysObject member)
{
return BulletSimAPI.GetPosition2(member.PhysBody.ptr);
}
public override OMV.Quaternion Orientation(BSPhysObject member)
{
return BulletSimAPI.GetOrientation2(member.PhysBody.ptr);
}
// Routine called when rebuilding the body of some member of the linkset.
// Destroy all the constraints have have been made to root and set
// up to rebuild the constraints before the next simulation step.

View File

@ -279,9 +279,12 @@ public sealed class BSPrim : BSPhysObject
}
public override OMV.Vector3 Position {
get {
/* NOTE: this refetch is not necessary. The simulator knows about linkset children
* and does not fetch this position info for children. Thus this is commented out.
// child prims move around based on their parent. Need to get the latest location
if (!Linkset.IsRoot(this))
_position = Linkset.Position(this);
_position = Linkset.PositionGet(this);
*/
// don't do the GetObjectPosition for root elements because this function is called a zillion times.
// _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr);
@ -289,21 +292,18 @@ public sealed class BSPrim : BSPhysObject
}
set {
// If the position must be forced into the physics engine, use ForcePosition.
// All positions are given in world positions.
if (_position == value)
{
DetailLog("{0},BSPrim.setPosition,taint,positionNotChanging,pos={1},orient={2}", LocalID, _position, _orientation);
return;
}
_position = value;
// TODO: what does it mean to set the position of a child prim?? Rebuild the constraint?
PositionSanityCheck(false);
PhysicsScene.TaintedObject("BSPrim.setPosition", delegate()
{
// DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
if (PhysBody.HasPhysicalBody)
{
BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
ActivateIfPhysical(false);
}
DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
ForcePosition = _position;
});
}
}
@ -314,9 +314,11 @@ public sealed class BSPrim : BSPhysObject
}
set {
_position = value;
// PositionSanityCheck(); // Don't do this! Causes a loop and caller should know better.
BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
ActivateIfPhysical(false);
if (PhysBody.HasPhysicalBody)
{
BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
ActivateIfPhysical(false);
}
}
}
@ -551,11 +553,14 @@ public sealed class BSPrim : BSPhysObject
}
public override OMV.Quaternion Orientation {
get {
/* NOTE: this refetch is not necessary. The simulator knows about linkset children
* and does not fetch this position info for children. Thus this is commented out.
// Children move around because tied to parent. Get a fresh value.
if (!Linkset.IsRoot(this))
{
_orientation = Linkset.Orientation(this);
_orientation = Linkset.OrientationGet(this);
}
*/
return _orientation;
}
set {

View File

@ -37,6 +37,7 @@ Border crossing with linked vehicle causes crash
BULLETSIM TODO LIST:
=================================================
Revisit CollisionMargin. Builders notice the 0.04 spacing between prims.
Avatar height off after unsitting (floats off ground)
Editting appearance then moving restores.
Must not be initializing height when recreating capsule after unsit.
@ -64,6 +65,8 @@ Implement ShapeCollection.Dispose()
Implement water as a plain so raycasting and collisions can happen with same.
Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE
Also osGetPhysicsEngineVerion() maybe.
Linkset.Position and Linkset.Orientation requre rewrite to properly return
child position. LinksetConstraint acts like it's at taint time!!
LINKSETS
======================================================