BulletSim: rip out old code for linkset child position fetching. BulletSim doesn't need to do that bookkeeping because SOG/SOP already does it.
parent
1a262bdde7
commit
ace1f1e931
|
@ -38,6 +38,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
// Each type of linkset will define the information needed for its type.
|
// Each type of linkset will define the information needed for its type.
|
||||||
public abstract class BSLinksetInfo
|
public abstract class BSLinksetInfo
|
||||||
{
|
{
|
||||||
|
public virtual void Clear() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class BSLinkset
|
public abstract class BSLinkset
|
||||||
|
@ -95,13 +96,6 @@ public abstract class BSLinkset
|
||||||
return BSPhysicsShapeType.SHAPE_UNKNOWN;
|
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
|
// We keep the prim's mass in the linkset structure since it could be dependent on other prims
|
||||||
protected float m_mass;
|
protected float m_mass;
|
||||||
public float LinksetMass
|
public float LinksetMass
|
||||||
|
|
|
@ -45,6 +45,11 @@ sealed class BSLinksetCompoundInfo : BSLinksetInfo
|
||||||
OffsetPos = p;
|
OffsetPos = p;
|
||||||
OffsetRot = r;
|
OffsetRot = r;
|
||||||
}
|
}
|
||||||
|
public override void Clear()
|
||||||
|
{
|
||||||
|
OffsetPos = OMV.Vector3.Zero;
|
||||||
|
OffsetRot = OMV.Quaternion.Identity;
|
||||||
|
}
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
StringBuilder buff = new StringBuilder();
|
StringBuilder buff = new StringBuilder();
|
||||||
|
@ -82,8 +87,11 @@ public sealed class BSLinksetCompound : BSLinkset
|
||||||
// its internal properties.
|
// its internal properties.
|
||||||
public override void Refresh(BSPhysObject requestor)
|
public override void Refresh(BSPhysObject requestor)
|
||||||
{
|
{
|
||||||
// External request for Refresh (from BSPrim) doesn't need to do anything
|
if (!IsRoot(requestor))
|
||||||
// InternalRefresh(requestor);
|
{
|
||||||
|
}
|
||||||
|
// Something changed so do the rebuilding thing
|
||||||
|
InternalRefresh(requestor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Schedule a refresh to happen after all the other taint processing.
|
// 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
|
// 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.
|
// 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.
|
// 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
|
// Returns 'true' of something was actually removed and would need restoring
|
||||||
|
|
|
@ -83,18 +83,6 @@ public sealed class BSLinksetConstraints : BSLinkset
|
||||||
// Nothing to do for constraints on property updates
|
// 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.
|
// Routine called when rebuilding the body of some member of the linkset.
|
||||||
// Destroy all the constraints have have been made to root and set
|
// Destroy all the constraints have have been made to root and set
|
||||||
// up to rebuild the constraints before the next simulation step.
|
// up to rebuild the constraints before the next simulation step.
|
||||||
|
|
|
@ -279,9 +279,12 @@ public sealed class BSPrim : BSPhysObject
|
||||||
}
|
}
|
||||||
public override OMV.Vector3 Position {
|
public override OMV.Vector3 Position {
|
||||||
get {
|
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
|
// child prims move around based on their parent. Need to get the latest location
|
||||||
if (!Linkset.IsRoot(this))
|
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.
|
// don't do the GetObjectPosition for root elements because this function is called a zillion times.
|
||||||
// _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr);
|
// _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr);
|
||||||
|
@ -289,21 +292,18 @@ public sealed class BSPrim : BSPhysObject
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
// If the position must be forced into the physics engine, use ForcePosition.
|
// If the position must be forced into the physics engine, use ForcePosition.
|
||||||
|
// All positions are given in world positions.
|
||||||
if (_position == value)
|
if (_position == value)
|
||||||
{
|
{
|
||||||
|
DetailLog("{0},BSPrim.setPosition,taint,positionNotChanging,pos={1},orient={2}", LocalID, _position, _orientation);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_position = value;
|
_position = value;
|
||||||
// TODO: what does it mean to set the position of a child prim?? Rebuild the constraint?
|
|
||||||
PositionSanityCheck(false);
|
PositionSanityCheck(false);
|
||||||
PhysicsScene.TaintedObject("BSPrim.setPosition", delegate()
|
PhysicsScene.TaintedObject("BSPrim.setPosition", delegate()
|
||||||
{
|
{
|
||||||
// DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
|
DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
|
||||||
if (PhysBody.HasPhysicalBody)
|
ForcePosition = _position;
|
||||||
{
|
|
||||||
BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
|
|
||||||
ActivateIfPhysical(false);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,9 +314,11 @@ public sealed class BSPrim : BSPhysObject
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
_position = value;
|
_position = value;
|
||||||
// PositionSanityCheck(); // Don't do this! Causes a loop and caller should know better.
|
if (PhysBody.HasPhysicalBody)
|
||||||
BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
|
{
|
||||||
ActivateIfPhysical(false);
|
BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
|
||||||
|
ActivateIfPhysical(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,11 +553,14 @@ public sealed class BSPrim : BSPhysObject
|
||||||
}
|
}
|
||||||
public override OMV.Quaternion Orientation {
|
public override OMV.Quaternion Orientation {
|
||||||
get {
|
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.
|
// Children move around because tied to parent. Get a fresh value.
|
||||||
if (!Linkset.IsRoot(this))
|
if (!Linkset.IsRoot(this))
|
||||||
{
|
{
|
||||||
_orientation = Linkset.Orientation(this);
|
_orientation = Linkset.OrientationGet(this);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return _orientation;
|
return _orientation;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
|
|
|
@ -37,6 +37,7 @@ Border crossing with linked vehicle causes crash
|
||||||
|
|
||||||
BULLETSIM TODO LIST:
|
BULLETSIM TODO LIST:
|
||||||
=================================================
|
=================================================
|
||||||
|
Revisit CollisionMargin. Builders notice the 0.04 spacing between prims.
|
||||||
Avatar height off after unsitting (floats off ground)
|
Avatar height off after unsitting (floats off ground)
|
||||||
Editting appearance then moving restores.
|
Editting appearance then moving restores.
|
||||||
Must not be initializing height when recreating capsule after unsit.
|
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.
|
Implement water as a plain so raycasting and collisions can happen with same.
|
||||||
Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE
|
Add osGetPhysicsEngineName() so scripters can tell whether BulletSim or ODE
|
||||||
Also osGetPhysicsEngineVerion() maybe.
|
Also osGetPhysicsEngineVerion() maybe.
|
||||||
|
Linkset.Position and Linkset.Orientation requre rewrite to properly return
|
||||||
|
child position. LinksetConstraint acts like it's at taint time!!
|
||||||
|
|
||||||
LINKSETS
|
LINKSETS
|
||||||
======================================================
|
======================================================
|
||||||
|
|
Loading…
Reference in New Issue