28 using System.Collections.Generic;
32 using OpenSim.Framework;
34 using OMV = OpenMetaverse;
36 namespace OpenSim.
Region.PhysicsModule.BulletS
44 #pragma warning disable 414
45 private static readonly
string LogHeader =
"[BULLETS PRIMLINKABLE]";
46 #pragma warning restore 414
52 public int LinksetChildIndex {
get; set; }
58 : base(localID, primName, parent_scene, pos, size,
rotation, pbs, pisPhysical)
65 Linkset.Refresh(
this);
70 Linkset = Linkset.RemoveMeFromLinkset(
this,
false );
74 public override void link(
OpenSim.Region.PhysicsModules.SharedBase.PhysicsActor obj)
80 int childrenBefore = Linkset.NumberOfChildren;
82 Linkset = parent.Linkset.AddMeToLinkset(
this);
84 DetailLog(
"{0},BSPrimLinkable.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}",
85 LocalID, parentBefore.
LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren);
96 int childrenBefore = Linkset.NumberOfChildren;
98 Linkset = Linkset.RemoveMeFromLinkset(
this,
false );
100 DetailLog(
"{0},BSPrimLinkable.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ",
101 LocalID, parentBefore.
LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren);
106 public override OMV.Vector3
Position
108 get {
return base.Position; }
111 base.Position = value;
112 PhysScene.TaintedObject(LocalID,
"BSPrimLinkable.setPosition", delegate()
114 Linkset.UpdateProperties(UpdatedProperties.Position,
this);
122 get {
return base.Orientation; }
125 base.Orientation = value;
126 PhysScene.TaintedObject(LocalID,
"BSPrimLinkable.setOrientation", delegate()
128 Linkset.UpdateProperties(UpdatedProperties.Orientation,
this);
133 public override float TotalMass
135 get {
return Linkset.LinksetMass; }
138 public override OMV.Vector3 CenterOfMass
140 get {
return Linkset.CenterOfMass; }
143 public override OMV.Vector3 GeometricCenter
145 get {
return Linkset.GeometricCenter; }
151 base.UpdatePhysicalParameters();
157 Linkset.Refresh(
this);
163 base.MakeDynamic(makeStatic);
167 Linkset.MakeStatic(
this);
169 Linkset.MakeDynamic(
this);
176 Linkset.RemoveDependencies(
this);
177 base.RemoveDependencies();
184 if (Linkset.IsRoot(
this) || Linkset.ShouldReportPropertyUpdates(
this))
188 base.UpdateProperties(entprop);
200 Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates,
this);
210 if (!Linkset.HandleCollide(
this, collidee, contactPoint, contactNormal, pentrationDepth))
213 ret = base.Collide(collidee, contactPoint, contactNormal, pentrationDepth);
219 public long SomeCollisionSimulationStep = 0;
220 public override bool HasSomeCollision
224 return (SomeCollisionSimulationStep == PhysScene.SimulationStep) || base.IsColliding;
229 SomeCollisionSimulationStep = PhysScene.SimulationStep;
231 SomeCollisionSimulationStep = 0;
233 base.HasSomeCollision = value;
241 if (LinksetType != newType)
243 DetailLog(
"{0},BSPrimLinkable.ConvertLinkset,oldT={1},newT={2}", LocalID, LinksetType, newType);
246 this.LinksetType = newType;
249 BSLinkset newLinkset = BSLinkset.Factory(PhysScene,
this);
251 this.Linkset = newLinkset;
254 oldLinkset.RemoveDependencies(
this);
257 List<BSPrimLinkable> children =
new List<BSPrimLinkable>();
258 oldLinkset.ForEachMember((child) =>
260 if (!oldLinkset.
IsRoot(child))
268 oldLinkset.RemoveMeFromLinkset(child,
true );
272 newLinkset.AddMeToLinkset(child);
273 child.Linkset = newLinkset;
277 newLinkset.Refresh(
this);
278 this.ForceBodyShapeRebuild(
true );
284 public override object Extension(
string pFunct, params
object[] pParams)
286 DetailLog(
"{0} BSPrimLinkable.Extension,op={1},nParam={2}", LocalID, pFunct, pParams.Length);
292 case ExtendedPhysics.PhysFunctGetLinksetType:
294 ret = (object)LinksetType;
295 DetailLog(
"{0},BSPrimLinkable.Extension.physGetLinksetType,type={1}", LocalID, ret);
300 case ExtendedPhysics.PhysFunctSetLinksetType:
302 if (pParams.Length > 2)
305 if (Linkset.IsRoot(
this))
307 PhysScene.TaintedObject(LocalID,
"BSPrim.PhysFunctSetLinksetType", delegate()
310 DetailLog(
"{0},BSPrimLinkable.Extension.physSetLinksetType, oldType={1},newType={2}",
311 LocalID, Linkset.LinksetImpl, linksetType);
312 ConvertLinkset(linksetType);
315 ret = (object)(
int)linksetType;
321 case ExtendedPhysics.PhysFunctChangeLinkType:
323 ret = Linkset.Extension(pFunct, pParams);
328 case ExtendedPhysics.PhysFunctGetLinkType:
330 ret = Linkset.Extension(pFunct, pParams);
335 case ExtendedPhysics.PhysFunctChangeLinkParams:
337 ret = Linkset.Extension(pFunct, pParams);
341 ret = base.Extension(pFunct, pParams);
346 #endregion // Extension
bool IsRoot(BSPrimLinkable requestor)
override void UpdateProperties(EntityProperties entprop)
override void RemoveDependencies()
override object Extension(string pFunct, params object[] pParams)
BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical)
override bool Collide(BSPhysObject collidee, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth)
OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion rotation
Interactive OpenSim region server
override void MakeDynamic(bool makeStatic)
override void link(OpenSim.Region.PhysicsModules.SharedBase.PhysicsActor obj)
static BSLinkset Factory(BSScene physScene, BSPrimLinkable parent)
override void UpdatePhysicalParameters()
bool ConvertLinkset(BSLinkset.LinksetImplementation newType)