aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-xOpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs6
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs16
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs43
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs52
4 files changed, 81 insertions, 36 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
index 10e13b9..2f88e2b 100755
--- a/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/ExtendedPhysics/ExtendedPhysics.cs
@@ -367,6 +367,7 @@ public class ExtendedPhysics : INonSharedRegionModule
367 // Code for specifying params. 367 // Code for specifying params.
368 // The choice if 14400 is arbitrary and only serves to catch parameter code misuse. 368 // The choice if 14400 is arbitrary and only serves to catch parameter code misuse.
369 public const int PHYS_PARAM_MIN = 14401; 369 public const int PHYS_PARAM_MIN = 14401;
370
370 [ScriptConstant] 371 [ScriptConstant]
371 public const int PHYS_PARAM_FRAMEINA_LOC = 14401; 372 public const int PHYS_PARAM_FRAMEINA_LOC = 14401;
372 [ScriptConstant] 373 [ScriptConstant]
@@ -401,7 +402,10 @@ public class ExtendedPhysics : INonSharedRegionModule
401 public const int PHYS_PARAM_SPRING_DAMPING = 14416; 402 public const int PHYS_PARAM_SPRING_DAMPING = 14416;
402 [ScriptConstant] 403 [ScriptConstant]
403 public const int PHYS_PARAM_SPRING_STIFFNESS = 14417; 404 public const int PHYS_PARAM_SPRING_STIFFNESS = 14417;
404 public const int PHYS_PARAM_MAX = 14417; 405 [ScriptConstant]
406 public const int PHYS_PARAM_LINK_TYPE = 14418;
407
408 public const int PHYS_PARAM_MAX = 14418;
405 409
406 // physChangeLinkParams(integer linkNum, [ PHYS_PARAM_*, value, PHYS_PARAM_*, value, ...]) 410 // physChangeLinkParams(integer linkNum, [ PHYS_PARAM_*, value, PHYS_PARAM_*, value, ...])
407 [ScriptInvocation] 411 [ScriptInvocation]
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs
index 5008ff7..7fcb75c 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs
@@ -59,9 +59,11 @@ public class BSConstraint6Dof : BSConstraint
59 frame2, frame2rot, 59 frame2, frame2rot,
60 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); 60 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
61 m_enabled = true; 61 m_enabled = true;
62 world.physicsScene.DetailLog("{0},BS6DofConstraint,createFrame,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", 62 PhysicsScene.DetailLog("{0},BS6DofConstraint,create,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}",
63 BSScene.DetailLogZero, world.worldID, 63 m_body1.ID, world.worldID,
64 obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); 64 obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString);
65 PhysicsScene.DetailLog("{0},BS6DofConstraint,create, f1Loc={1},f1Rot={2},f2Loc={3},f2Rot={4},usefA={5},disCol={6}",
66 m_body1.ID, frame1, frame1rot, frame2, frame2rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
65 } 67 }
66 68
67 // 6 Dof constraint based on a midpoint between the two constrained bodies 69 // 6 Dof constraint based on a midpoint between the two constrained bodies
@@ -86,9 +88,11 @@ public class BSConstraint6Dof : BSConstraint
86 m_constraint = PhysicsScene.PE.Create6DofConstraintToPoint(m_world, m_body1, m_body2, 88 m_constraint = PhysicsScene.PE.Create6DofConstraintToPoint(m_world, m_body1, m_body2,
87 joinPoint, 89 joinPoint,
88 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); 90 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
91
89 PhysicsScene.DetailLog("{0},BS6DofConstraint,createMidPoint,wID={1}, csrt={2}, rID={3}, rBody={4}, cID={5}, cBody={6}", 92 PhysicsScene.DetailLog("{0},BS6DofConstraint,createMidPoint,wID={1}, csrt={2}, rID={3}, rBody={4}, cID={5}, cBody={6}",
90 BSScene.DetailLogZero, world.worldID, m_constraint.AddrString, 93 m_body1.ID, world.worldID, m_constraint.AddrString,
91 obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); 94 obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString);
95
92 if (!m_constraint.HasPhysicalConstraint) 96 if (!m_constraint.HasPhysicalConstraint)
93 { 97 {
94 world.physicsScene.Logger.ErrorFormat("{0} Failed creation of 6Dof constraint. rootID={1}, childID={2}", 98 world.physicsScene.Logger.ErrorFormat("{0} Failed creation of 6Dof constraint. rootID={1}, childID={2}",
@@ -113,8 +117,10 @@ public class BSConstraint6Dof : BSConstraint
113 frameInBloc, frameInBrot, 117 frameInBloc, frameInBrot,
114 useLinearReferenceFrameB, disableCollisionsBetweenLinkedBodies); 118 useLinearReferenceFrameB, disableCollisionsBetweenLinkedBodies);
115 m_enabled = true; 119 m_enabled = true;
116 world.physicsScene.DetailLog("{0},BS6DofConstraint,createFixed,wID={1},rID={2},rBody={3}", 120 PhysicsScene.DetailLog("{0},BS6DofConstraint,createFixed,wID={1},rID={2},rBody={3}",
117 BSScene.DetailLogZero, world.worldID, obj1.ID, obj1.AddrString); 121 m_body1.ID, world.worldID, obj1.ID, obj1.AddrString);
122 PhysicsScene.DetailLog("{0},BS6DofConstraint,createFixed, fBLoc={1},fBRot={2},usefA={3},disCol={4}",
123 m_body1.ID, frameInBloc, frameInBrot, useLinearReferenceFrameB, disableCollisionsBetweenLinkedBodies);
118 } 124 }
119 125
120 public bool SetFrames(Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot) 126 public bool SetFrames(Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot)
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs
index 01d67d4..410584d 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSpring.cs
@@ -47,37 +47,42 @@ public sealed class BSConstraintSpring : BSConstraint6Dof
47 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); 47 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
48 m_enabled = true; 48 m_enabled = true;
49 49
50 world.physicsScene.DetailLog("{0},BSConstraintSpring,createFrame,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}", 50 PhysicsScene.DetailLog("{0},BSConstraintSpring,create,wID={1}, rID={2}, rBody={3}, cID={4}, cBody={5}",
51 BSScene.DetailLogZero, world.worldID, 51 obj1.ID, world.worldID, obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString);
52 obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); 52 PhysicsScene.DetailLog("{0},BSConstraintSpring,create, f1Loc={1},f1Rot={2},f2Loc={3},f2Rot={4},usefA={5},disCol={6}",
53 m_body1.ID, frame1Loc, frame1Rot, frame2Loc, frame2Rot, useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
53 } 54 }
54 55
55 public bool SetEnable(int index, bool axisEnable) 56 public bool SetEnable(int pIndex, bool pAxisEnable)
56 { 57 {
57 bool ret = false; 58 PhysicsScene.DetailLog("{0},BSConstraintSpring.SetEnable,obj1ID={1},obj2ID={2},indx={3},enable={4}",
58 59 m_body1.ID, m_body1.ID, m_body2.ID, pIndex, pAxisEnable);
59 return ret; 60 PhysicsScene.PE.SpringEnable(m_constraint, pIndex, BSParam.NumericBool(pAxisEnable));
61 return true;
60 } 62 }
61 63
62 public bool SetStiffness(int index, float stiffness) 64 public bool SetStiffness(int pIndex, float pStiffness)
63 { 65 {
64 bool ret = false; 66 PhysicsScene.DetailLog("{0},BSConstraintSpring.SetStiffness,obj1ID={1},obj2ID={2},indx={3},enable={4}",
65 67 m_body1.ID, m_body1.ID, m_body2.ID, pIndex, pStiffness);
66 return ret; 68 PhysicsScene.PE.SpringSetStiffness(m_constraint, pIndex, pStiffness);
69 return true;
67 } 70 }
68 71
69 public bool SetDamping(int index, float damping) 72 public bool SetDamping(int pIndex, float pDamping)
70 { 73 {
71 bool ret = false; 74 PhysicsScene.DetailLog("{0},BSConstraintSpring.SetDamping,obj1ID={1},obj2ID={2},indx={3},enable={4}",
72 75 m_body1.ID, m_body1.ID, m_body2.ID, pIndex, pDamping);
73 return ret; 76 PhysicsScene.PE.SpringSetDamping(m_constraint, pIndex, pDamping);
77 return true;
74 } 78 }
75 79
76 public bool SetEquilibriumPoint(int index, float eqPoint) 80 public bool SetEquilibriumPoint(int pIndex, float pEqPoint)
77 { 81 {
78 bool ret = false; 82 PhysicsScene.DetailLog("{0},BSConstraintSpring.SetEquilibriumPoint,obj1ID={1},obj2ID={2},indx={3},enable={4}",
79 83 m_body1.ID, m_body1.ID, m_body2.ID, pIndex, pEqPoint);
80 return ret; 84 PhysicsScene.PE.SpringSetEquilibriumPoint(m_constraint, pIndex, pEqPoint);
85 return true;
81 } 86 }
82 87
83} 88}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
index a9ae89d..be97c29 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
@@ -67,6 +67,7 @@ public sealed class BSLinksetConstraints : BSLinkset
67 { 67 {
68 constraint = null; 68 constraint = null;
69 ResetLink(); 69 ResetLink();
70 member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.creation", member.LocalID);
70 } 71 }
71 72
72 // Set all the parameters for this constraint to a fixed, non-movable constraint. 73 // Set all the parameters for this constraint to a fixed, non-movable constraint.
@@ -91,11 +92,13 @@ public sealed class BSLinksetConstraints : BSLinkset
91 frameInBrot = OMV.Quaternion.Identity; 92 frameInBrot = OMV.Quaternion.Identity;
92 springDamping = -1f; 93 springDamping = -1f;
93 springStiffness = -1f; 94 springStiffness = -1f;
95 member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.ResetLink", member.LocalID);
94 } 96 }
95 97
96 // Given a constraint, apply the current constraint parameters to same. 98 // Given a constraint, apply the current constraint parameters to same.
97 public override void SetLinkParameters(BSConstraint constrain) 99 public override void SetLinkParameters(BSConstraint constrain)
98 { 100 {
101 member.PhysScene.DetailLog("{0},BSLinkInfoConstraint.SetLinkParameters,type={1}", member.LocalID, constraintType);
99 switch (constraintType) 102 switch (constraintType)
100 { 103 {
101 case ConstraintType.FIXED_CONSTRAINT_TYPE: 104 case ConstraintType.FIXED_CONSTRAINT_TYPE:
@@ -139,7 +142,7 @@ public sealed class BSLinksetConstraints : BSLinkset
139 if (springDamping != -1) 142 if (springDamping != -1)
140 constrainSpring.SetDamping(ii, springDamping); 143 constrainSpring.SetDamping(ii, springDamping);
141 if (springStiffness != -1) 144 if (springStiffness != -1)
142 constrainSpring.SetStiffness(ii, springStiffness); 145 constrainSpring.SetStiffness(ii, springStiffness);
143 } 146 }
144 } 147 }
145 break; 148 break;
@@ -155,7 +158,6 @@ public sealed class BSLinksetConstraints : BSLinkset
155 public override bool ShouldUpdateChildProperties() 158 public override bool ShouldUpdateChildProperties()
156 { 159 {
157 bool ret = true; 160 bool ret = true;
158
159 if (constraintType == ConstraintType.FIXED_CONSTRAINT_TYPE) 161 if (constraintType == ConstraintType.FIXED_CONSTRAINT_TYPE)
160 ret = false; 162 ret = false;
161 163
@@ -193,10 +195,16 @@ public sealed class BSLinksetConstraints : BSLinkset
193 { 195 {
194 // Queue to happen after all the other taint processing 196 // Queue to happen after all the other taint processing
195 m_physicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate() 197 m_physicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate()
198 {
199 if (HasAnyChildren)
196 { 200 {
197 if (HasAnyChildren) 201 // Constraints that have not been changed are not rebuild but make sure
198 RecomputeLinksetConstraints(); 202 // the constraint of the requestor is rebuilt.
199 }); 203 PhysicallyUnlinkAChildFromRoot(LinksetRoot, requestor);
204 // Rebuild the linkset and all its constraints.
205 RecomputeLinksetConstraints();
206 }
207 });
200 } 208 }
201 } 209 }
202 210
@@ -415,13 +423,22 @@ public sealed class BSLinksetConstraints : BSLinkset
415 rootPrim.LocalID, rootPrim.PhysBody.AddrString, 423 rootPrim.LocalID, rootPrim.PhysBody.AddrString,
416 childPrim.LocalID, childPrim.PhysBody.AddrString); 424 childPrim.LocalID, childPrim.PhysBody.AddrString);
417 425
418 // Find the constraint for this link and get rid of it from the overall collection and from my list 426 // If asked to unlink root from root, just remove all the constraints
419 if (m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody, childPrim.PhysBody)) 427 if (rootPrim == childPrim || childPrim == LinksetRoot)
420 { 428 {
421 // Make the child refresh its location 429 PhysicallyUnlinkAllChildrenFromRoot(LinksetRoot);
422 m_physicsScene.PE.PushUpdate(childPrim.PhysBody);
423 ret = true; 430 ret = true;
424 } 431 }
432 else
433 {
434 // Find the constraint for this link and get rid of it from the overall collection and from my list
435 if (m_physicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody, childPrim.PhysBody))
436 {
437 // Make the child refresh its location
438 m_physicsScene.PE.PushUpdate(childPrim.PhysBody);
439 ret = true;
440 }
441 }
425 442
426 return ret; 443 return ret;
427 } 444 }
@@ -521,8 +538,6 @@ public sealed class BSLinksetConstraints : BSLinkset
521 BSLinkInfoConstraint linkInfoC = linkInfo as BSLinkInfoConstraint; 538 BSLinkInfoConstraint linkInfoC = linkInfo as BSLinkInfoConstraint;
522 if (linkInfoC != null) 539 if (linkInfoC != null)
523 { 540 {
524 // Setting to fixed is easy. The reset state is the fixed link configuration.
525 linkInfoC.ResetLink();
526 linkInfoC.constraintType = (ConstraintType)requestedType; 541 linkInfoC.constraintType = (ConstraintType)requestedType;
527 ret = (object)true; 542 ret = (object)true;
528 DetailLog("{0},BSLinksetConstraint.ChangeLinkType,link={1},type={2}", 543 DetailLog("{0},BSLinksetConstraint.ChangeLinkType,link={1},type={2}",
@@ -589,6 +604,7 @@ public sealed class BSLinksetConstraints : BSLinkset
589 BSLinkInfoConstraint linkInfo = baseLinkInfo as BSLinkInfoConstraint; 604 BSLinkInfoConstraint linkInfo = baseLinkInfo as BSLinkInfoConstraint;
590 if (linkInfo != null) 605 if (linkInfo != null)
591 { 606 {
607 int valueInt;
592 float valueFloat; 608 float valueFloat;
593 bool valueBool; 609 bool valueBool;
594 OMV.Vector3 valueVector; 610 OMV.Vector3 valueVector;
@@ -602,6 +618,20 @@ public sealed class BSLinksetConstraints : BSLinkset
602 linkInfo.member.LocalID, thisOp, pParams[opIndex+1]); 618 linkInfo.member.LocalID, thisOp, pParams[opIndex+1]);
603 switch (thisOp) 619 switch (thisOp)
604 { 620 {
621 case ExtendedPhysics.PHYS_PARAM_LINK_TYPE:
622 valueInt = (int)pParams[opIndex + 1];
623 ConstraintType valueType = (ConstraintType)valueInt;
624 if (valueType == ConstraintType.FIXED_CONSTRAINT_TYPE
625 || valueType == ConstraintType.D6_CONSTRAINT_TYPE
626 || valueType == ConstraintType.D6_SPRING_CONSTRAINT_TYPE
627 || valueType == ConstraintType.HINGE_CONSTRAINT_TYPE
628 || valueType == ConstraintType.CONETWIST_CONSTRAINT_TYPE
629 || valueType == ConstraintType.SLIDER_CONSTRAINT_TYPE)
630 {
631 linkInfo.constraintType = valueType;
632 }
633 opIndex += 2;
634 break;
605 case ExtendedPhysics.PHYS_PARAM_FRAMEINA_LOC: 635 case ExtendedPhysics.PHYS_PARAM_FRAMEINA_LOC:
606 valueVector = (OMV.Vector3)pParams[opIndex + 1]; 636 valueVector = (OMV.Vector3)pParams[opIndex + 1];
607 linkInfo.frameInAloc = valueVector; 637 linkInfo.frameInAloc = valueVector;