BulletSim: initial implementation of physChangeLinkFixed that resets a linkset's link back to a fixed, non-moving connection.
parent
1a8a6b95e5
commit
3ffad76b0d
|
@ -61,6 +61,10 @@ public class ExtendedPhysics : INonSharedRegionModule
|
||||||
// Per prim functions. See BSPrim.
|
// Per prim functions. See BSPrim.
|
||||||
public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
|
public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
|
||||||
public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
|
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";
|
||||||
|
|
||||||
// =============================================================
|
// =============================================================
|
||||||
|
|
||||||
|
@ -250,7 +254,6 @@ public class ExtendedPhysics : INonSharedRegionModule
|
||||||
public int physGetLinksetType(UUID hostID, UUID scriptID)
|
public int physGetLinksetType(UUID hostID, UUID scriptID)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
if (!Enabled) return ret;
|
if (!Enabled) return ret;
|
||||||
|
|
||||||
// The part that is requesting the change.
|
// The part that is requesting the change.
|
||||||
|
@ -287,5 +290,82 @@ public class ExtendedPhysics : INonSharedRegionModule
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ScriptInvocation]
|
||||||
|
public int physChangeLinkFixed(UUID hostID, UUID scriptID, int linkNum)
|
||||||
|
{
|
||||||
|
int ret = -1;
|
||||||
|
if (!Enabled) return ret;
|
||||||
|
|
||||||
|
// The part that is requesting the change.
|
||||||
|
SceneObjectPart requestingPart = BaseScene.GetSceneObjectPart(hostID);
|
||||||
|
|
||||||
|
if (requestingPart != null)
|
||||||
|
{
|
||||||
|
// The type is is always on the root of a linkset.
|
||||||
|
SceneObjectGroup containingGroup = requestingPart.ParentGroup;
|
||||||
|
SceneObjectPart rootPart = containingGroup.RootPart;
|
||||||
|
|
||||||
|
if (rootPart != null)
|
||||||
|
{
|
||||||
|
Physics.Manager.PhysicsActor rootPhysActor = rootPart.PhysActor;
|
||||||
|
if (rootPhysActor != null)
|
||||||
|
{
|
||||||
|
SceneObjectPart linkPart = containingGroup.GetLinkNumPart(linkNum);
|
||||||
|
if (linkPart != null)
|
||||||
|
{
|
||||||
|
Physics.Manager.PhysicsActor linkPhysActor = linkPart.PhysActor;
|
||||||
|
if (linkPhysActor != null)
|
||||||
|
{
|
||||||
|
ret = (int)rootPhysActor.Extension(PhysFunctChangeLinkFixed, linkNum, linkPhysActor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0} physChangeLinkFixed: Link part has no physical actor. rootName={1}, hostID={2}, linknum={3}",
|
||||||
|
LogHeader, rootPart.Name, hostID, linkNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0} physChangeLinkFixed: Could not find linknum part. rootName={1}, hostID={2}, linknum={3}",
|
||||||
|
LogHeader, rootPart.Name, hostID, linkNum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0} physChangeLinkFixed: Root part does not have a physics actor. rootName={1}, hostID={2}",
|
||||||
|
LogHeader, rootPart.Name, hostID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0} physChangeLinkFixed: Root part does not exist. RequestingPartName={1}, hostID={2}",
|
||||||
|
LogHeader, requestingPart.Name, hostID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.WarnFormat("{0} physGetLinsetType: cannot find script object in scene. hostID={1}", LogHeader, hostID);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ScriptInvocation]
|
||||||
|
public int physChangeLinkHinge(UUID hostID, UUID scriptID, int linkNum)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ScriptInvocation]
|
||||||
|
public int physChangeLinkSpring(UUID hostID, UUID scriptID, int linkNum)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
[ScriptInvocation]
|
||||||
|
public int physChangeLinkSlider(UUID hostID, UUID scriptID, int linkNum)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,10 +60,7 @@ public class BSPrimLinkable : BSPrimDisplaced
|
||||||
|
|
||||||
Linkset = BSLinkset.Factory(PhysScene, this);
|
Linkset = BSLinkset.Factory(PhysScene, this);
|
||||||
|
|
||||||
PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate()
|
Linkset.Refresh(this);
|
||||||
{
|
|
||||||
Linkset.Refresh(this);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Destroy()
|
public override void Destroy()
|
||||||
|
@ -82,7 +79,7 @@ public class BSPrimLinkable : BSPrimDisplaced
|
||||||
|
|
||||||
Linkset = parent.Linkset.AddMeToLinkset(this);
|
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);
|
LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -98,7 +95,7 @@ public class BSPrimLinkable : BSPrimDisplaced
|
||||||
|
|
||||||
Linkset = Linkset.RemoveMeFromLinkset(this, false /* inTaintTime*/);
|
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);
|
LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +107,7 @@ public class BSPrimLinkable : BSPrimDisplaced
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
base.Position = value;
|
base.Position = value;
|
||||||
PhysScene.TaintedObject("BSPrimLinkset.setPosition", delegate()
|
PhysScene.TaintedObject("BSPrimLinkable.setPosition", delegate()
|
||||||
{
|
{
|
||||||
Linkset.UpdateProperties(UpdatedProperties.Position, this);
|
Linkset.UpdateProperties(UpdatedProperties.Position, this);
|
||||||
});
|
});
|
||||||
|
@ -124,7 +121,7 @@ public class BSPrimLinkable : BSPrimDisplaced
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
base.Orientation = value;
|
base.Orientation = value;
|
||||||
PhysScene.TaintedObject("BSPrimLinkset.setOrientation", delegate()
|
PhysScene.TaintedObject("BSPrimLinkable.setOrientation", delegate()
|
||||||
{
|
{
|
||||||
Linkset.UpdateProperties(UpdatedProperties.Orientation, this);
|
Linkset.UpdateProperties(UpdatedProperties.Orientation, this);
|
||||||
});
|
});
|
||||||
|
@ -242,7 +239,7 @@ public class BSPrimLinkable : BSPrimDisplaced
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
if (LinksetType != newType)
|
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.
|
// Set the implementation type first so the call to BSLinkset.Factory gets the new type.
|
||||||
this.LinksetType = newType;
|
this.LinksetType = newType;
|
||||||
|
@ -288,12 +285,14 @@ public class BSPrimLinkable : BSPrimDisplaced
|
||||||
object ret = null;
|
object ret = null;
|
||||||
switch (pFunct)
|
switch (pFunct)
|
||||||
{
|
{
|
||||||
|
// physGetLinksetType();
|
||||||
case BSScene.PhysFunctGetLinksetType:
|
case BSScene.PhysFunctGetLinksetType:
|
||||||
{
|
{
|
||||||
ret = (object)LinksetType;
|
ret = (object)LinksetType;
|
||||||
m_log.DebugFormat("{0} Extension.physGetLinksetType, type={1}", LogHeader, ret);
|
m_log.DebugFormat("{0} Extension.physGetLinksetType, type={1}", LogHeader, ret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// physSetLinksetType(type);
|
||||||
case BSScene.PhysFunctSetLinksetType:
|
case BSScene.PhysFunctSetLinksetType:
|
||||||
{
|
{
|
||||||
if (pParams.Length > 0)
|
if (pParams.Length > 0)
|
||||||
|
@ -313,6 +312,18 @@ public class BSPrimLinkable : BSPrimDisplaced
|
||||||
}
|
}
|
||||||
break;
|
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:
|
default:
|
||||||
ret = base.Extension(pFunct, pParams);
|
ret = base.Extension(pFunct, pParams);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -875,6 +875,10 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
|
||||||
// Per prim functions. See BSPrim.
|
// Per prim functions. See BSPrim.
|
||||||
public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
|
public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
|
||||||
public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
|
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)
|
public override object Extension(string pFunct, params object[] pParams)
|
||||||
|
|
Loading…
Reference in New Issue