BulletSim: initial implementation of physChangeLinkFixed that resets a linkset's link back to a fixed, non-moving connection.

This commit is contained in:
Robert Adams
2013-08-07 11:13:53 -07:00
parent c6a6631efc
commit f3cc20050e
3 changed files with 105 additions and 10 deletions

View File

@@ -60,10 +60,7 @@ public class BSPrimLinkable : BSPrimDisplaced
Linkset = BSLinkset.Factory(PhysScene, this);
PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate()
{
Linkset.Refresh(this);
});
Linkset.Refresh(this);
}
public override void Destroy()
@@ -82,7 +79,7 @@ public class BSPrimLinkable : BSPrimDisplaced
Linkset = parent.Linkset.AddMeToLinkset(this);
DetailLog("{0},BSPrimLinkset.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}",
DetailLog("{0},BSPrimLinkable.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}",
LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren);
}
return;
@@ -98,7 +95,7 @@ public class BSPrimLinkable : BSPrimDisplaced
Linkset = Linkset.RemoveMeFromLinkset(this, false /* inTaintTime*/);
DetailLog("{0},BSPrimLinkset.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ",
DetailLog("{0},BSPrimLinkable.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ",
LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren);
return;
}
@@ -110,7 +107,7 @@ public class BSPrimLinkable : BSPrimDisplaced
set
{
base.Position = value;
PhysScene.TaintedObject("BSPrimLinkset.setPosition", delegate()
PhysScene.TaintedObject("BSPrimLinkable.setPosition", delegate()
{
Linkset.UpdateProperties(UpdatedProperties.Position, this);
});
@@ -124,7 +121,7 @@ public class BSPrimLinkable : BSPrimDisplaced
set
{
base.Orientation = value;
PhysScene.TaintedObject("BSPrimLinkset.setOrientation", delegate()
PhysScene.TaintedObject("BSPrimLinkable.setOrientation", delegate()
{
Linkset.UpdateProperties(UpdatedProperties.Orientation, this);
});
@@ -242,7 +239,7 @@ public class BSPrimLinkable : BSPrimDisplaced
bool ret = false;
if (LinksetType != newType)
{
DetailLog("{0},BSPrimLinkset.ConvertLinkset,oldT={1},newT={2}", LocalID, LinksetType, newType);
DetailLog("{0},BSPrimLinkable.ConvertLinkset,oldT={1},newT={2}", LocalID, LinksetType, newType);
// Set the implementation type first so the call to BSLinkset.Factory gets the new type.
this.LinksetType = newType;
@@ -288,12 +285,14 @@ public class BSPrimLinkable : BSPrimDisplaced
object ret = null;
switch (pFunct)
{
// physGetLinksetType();
case BSScene.PhysFunctGetLinksetType:
{
ret = (object)LinksetType;
m_log.DebugFormat("{0} Extension.physGetLinksetType, type={1}", LogHeader, ret);
break;
}
// physSetLinksetType(type);
case BSScene.PhysFunctSetLinksetType:
{
if (pParams.Length > 0)
@@ -313,6 +312,18 @@ public class BSPrimLinkable : BSPrimDisplaced
}
break;
}
// physChangeLinkFixed(linknum);
// Params: int linkNum, PhysActor linkedPrim
case BSScene.PhysFunctChangeLinkFixed:
{
if (pParams.Length > 1)
{
int linkNum = (int)pParams[0];
Manager.PhysicsActor linkActor = (Manager.PhysicsActor)pParams[1];
Linkset.Refresh(this);
}
break;
}
default:
ret = base.Extension(pFunct, pParams);
break;

View File

@@ -875,6 +875,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
// Per prim functions. See BSPrim.
public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed";
public const string PhysFunctChangeLinkHinge = "BulletSim.ChangeLinkHinge";
public const string PhysFunctChangeLinkSpring = "BulletSim.ChangeLinkSpring";
public const string PhysFunctChangeLinkSlider = "BulletSim.ChangeLinkSlider";
// =============================================================
public override object Extension(string pFunct, params object[] pParams)