aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2013-08-20 08:14:08 -0700
committerRobert Adams2013-09-11 09:12:02 -0700
commit4781297b4ee5908b76039ce3b38291eb2e89e157 (patch)
tree02eda7c6afb4137afbffacb82dc1507a778ffe0f /OpenSim/Region/Physics
parentBulletSim: adjust avatar capsule height calculation to be closer to defined S... (diff)
downloadopensim-SC_OLD-4781297b4ee5908b76039ce3b38291eb2e89e157.zip
opensim-SC_OLD-4781297b4ee5908b76039ce3b38291eb2e89e157.tar.gz
opensim-SC_OLD-4781297b4ee5908b76039ce3b38291eb2e89e157.tar.bz2
opensim-SC_OLD-4781297b4ee5908b76039ce3b38291eb2e89e157.tar.xz
BulletSim: Extension parameters passed through the classes made to pass just and array of objects rather than a mixture of parameters and array. Makes understanding and parsing what is being passed much easier.
Diffstat (limited to 'OpenSim/Region/Physics')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs93
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs15
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs1
4 files changed, 80 insertions, 30 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
index 92df84e..87716b4 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
@@ -343,7 +343,7 @@ public sealed class BSLinksetConstraints : BSLinkset
343 // real world coordinate of midpoint between the two objects 343 // real world coordinate of midpoint between the two objects
344 OMV.Vector3 midPoint = rootPrim.Position + (childRelativePosition / 2); 344 OMV.Vector3 midPoint = rootPrim.Position + (childRelativePosition / 2);
345 345
346 DetailLog("{0},BSLinksetConstraint.BuildConstraint,6Dof,rBody={1},cBody={2},rLoc={3},cLoc={4},midLoc={7}", 346 DetailLog("{0},BSLinksetConstraint.BuildConstraint,6Dof,rBody={1},cBody={2},rLoc={3},cLoc={4},midLoc={5}",
347 rootPrim.LocalID, rootPrim.PhysBody, linkInfo.member.PhysBody, 347 rootPrim.LocalID, rootPrim.PhysBody, linkInfo.member.PhysBody,
348 rootPrim.Position, linkInfo.member.Position, midPoint); 348 rootPrim.Position, linkInfo.member.Position, midPoint);
349 349
@@ -492,11 +492,12 @@ public sealed class BSLinksetConstraints : BSLinkset
492 object ret = null; 492 object ret = null;
493 switch (pFunct) 493 switch (pFunct)
494 { 494 {
495 // pParams = (int linkNUm, PhysActor linkChild) 495 // pParams = [ BSPhysObject child, integer linkType ]
496 case ExtendedPhysics.PhysFunctChangeLinkType: 496 case ExtendedPhysics.PhysFunctChangeLinkType:
497 if (pParams.Length > 1) 497 if (pParams.Length > 1)
498 { 498 {
499 int requestedType = (int)pParams[1]; 499 int requestedType = (int)pParams[1];
500 DetailLog("{0},BSLinksetConstraint.SetLinkType,requestedType={1}", LinksetRoot.LocalID, requestedType);
500 if (requestedType == (int)ConstraintType.FIXED_CONSTRAINT_TYPE 501 if (requestedType == (int)ConstraintType.FIXED_CONSTRAINT_TYPE
501 || requestedType == (int)ConstraintType.D6_CONSTRAINT_TYPE 502 || requestedType == (int)ConstraintType.D6_CONSTRAINT_TYPE
502 || requestedType == (int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE 503 || requestedType == (int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE
@@ -507,7 +508,7 @@ public sealed class BSLinksetConstraints : BSLinkset
507 BSPrimLinkable child = pParams[0] as BSPrimLinkable; 508 BSPrimLinkable child = pParams[0] as BSPrimLinkable;
508 if (child != null) 509 if (child != null)
509 { 510 {
510 m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkFixed", delegate() 511 m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkType", delegate()
511 { 512 {
512 // Pick up all the constraints currently created. 513 // Pick up all the constraints currently created.
513 RemoveDependencies(child); 514 RemoveDependencies(child);
@@ -522,15 +523,35 @@ public sealed class BSLinksetConstraints : BSLinkset
522 linkInfoC.ResetLink(); 523 linkInfoC.ResetLink();
523 linkInfoC.constraintType = (ConstraintType)requestedType; 524 linkInfoC.constraintType = (ConstraintType)requestedType;
524 ret = (object)true; 525 ret = (object)true;
526 DetailLog("{0},BSLinksetConstraint.SetLinkType,link={1},type={2}",
527 linkInfo.member.LocalID, linkInfo.member.LocalID, linkInfoC.constraintType);
528 }
529 else
530 {
531 DetailLog("{0},BSLinksetConstraint.SetLinkType,linkInfoNotConstraint,childID={1}", LinksetRoot.LocalID, child.LocalID);
525 } 532 }
526 } 533 }
534 else
535 {
536 DetailLog("{0},BSLinksetConstraint.SetLinkType,noLinkInfoForChild,childID={1}", LinksetRoot.LocalID, child.LocalID);
537 }
527 // Cause the whole linkset to be rebuilt in post-taint time. 538 // Cause the whole linkset to be rebuilt in post-taint time.
528 Refresh(child); 539 Refresh(child);
529 }); 540 });
530 } 541 }
542 else
543 {
544 DetailLog("{0},BSLinksetConstraint.SetLinkType,childNotBSPrimLinkable", LinksetRoot.LocalID);
545 }
546 }
547 else
548 {
549 DetailLog("{0},BSLinksetConstraint.SetLinkType,illegalRequestedType,reqested={1},spring={2}",
550 LinksetRoot.LocalID, requestedType, ((int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE));
531 } 551 }
532 } 552 }
533 break; 553 break;
554 // pParams = []
534 case ExtendedPhysics.PhysFunctGetLinkType: 555 case ExtendedPhysics.PhysFunctGetLinkType:
535 if (pParams.Length > 0) 556 if (pParams.Length > 0)
536 { 557 {
@@ -544,11 +565,15 @@ public sealed class BSLinksetConstraints : BSLinkset
544 if (linkInfoC != null) 565 if (linkInfoC != null)
545 { 566 {
546 ret = (object)(int)linkInfoC.constraintType; 567 ret = (object)(int)linkInfoC.constraintType;
568 DetailLog("{0},BSLinksetConstraint.GetLinkType,link={1},type={2}",
569 linkInfo.member.LocalID, linkInfo.member.LocalID, linkInfoC.constraintType);
570
547 } 571 }
548 } 572 }
549 } 573 }
550 } 574 }
551 break; 575 break;
576 // pParams = [ BSPhysObject child, int op, object opParams, int op, object opParams, ... ]
552 case ExtendedPhysics.PhysFunctChangeLinkParams: 577 case ExtendedPhysics.PhysFunctChangeLinkParams:
553 // There should be two parameters: the childActor and a list of parameters to set 578 // There should be two parameters: the childActor and a list of parameters to set
554 try 579 try
@@ -556,7 +581,6 @@ public sealed class BSLinksetConstraints : BSLinkset
556 if (pParams.Length > 1) 581 if (pParams.Length > 1)
557 { 582 {
558 BSPrimLinkable child = pParams[0] as BSPrimLinkable; 583 BSPrimLinkable child = pParams[0] as BSPrimLinkable;
559 object[] setOps = (object[])pParams[1];
560 BSLinkInfo baseLinkInfo = null; 584 BSLinkInfo baseLinkInfo = null;
561 if (TryGetLinkInfo(child, out baseLinkInfo)) 585 if (TryGetLinkInfo(child, out baseLinkInfo))
562 { 586 {
@@ -568,85 +592,106 @@ public sealed class BSLinksetConstraints : BSLinkset
568 OMV.Vector3 valueVector; 592 OMV.Vector3 valueVector;
569 OMV.Quaternion valueQuaternion; 593 OMV.Quaternion valueQuaternion;
570 594
571 int opIndex = 0; 595 int opIndex = 1;
572 while (opIndex < setOps.Length) 596 while (opIndex < pParams.Length)
573 { 597 {
574 int thisOp = (int)setOps[opIndex]; 598 int thisOp = (int)pParams[opIndex];
599 DetailLog("{0},BSLinksetConstraint.ChangeLinkParams2,op={1},val={2}",
600 linkInfo.member.LocalID, thisOp, pParams[opIndex+1]);
575 switch (thisOp) 601 switch (thisOp)
576 { 602 {
577 case ExtendedPhysics.PHYS_PARAM_FRAMEINA_LOC: 603 case ExtendedPhysics.PHYS_PARAM_FRAMEINA_LOC:
578 valueVector = (OMV.Vector3)setOps[opIndex + 1]; 604 valueVector = (OMV.Vector3)pParams[opIndex + 1];
579 linkInfo.frameInAloc = valueVector; 605 linkInfo.frameInAloc = valueVector;
606 opIndex += 2;
580 break; 607 break;
581 case ExtendedPhysics.PHYS_PARAM_FRAMEINA_ROT: 608 case ExtendedPhysics.PHYS_PARAM_FRAMEINA_ROT:
582 valueQuaternion = (OMV.Quaternion)setOps[opIndex + 1]; 609 valueQuaternion = (OMV.Quaternion)pParams[opIndex + 1];
583 linkInfo.frameInArot = valueQuaternion; 610 linkInfo.frameInArot = valueQuaternion;
611 opIndex += 2;
584 break; 612 break;
585 case ExtendedPhysics.PHYS_PARAM_FRAMEINB_LOC: 613 case ExtendedPhysics.PHYS_PARAM_FRAMEINB_LOC:
586 valueVector = (OMV.Vector3)setOps[opIndex + 1]; 614 valueVector = (OMV.Vector3)pParams[opIndex + 1];
587 linkInfo.frameInBloc = valueVector; 615 linkInfo.frameInBloc = valueVector;
616 opIndex += 2;
588 break; 617 break;
589 case ExtendedPhysics.PHYS_PARAM_FRAMEINB_ROT: 618 case ExtendedPhysics.PHYS_PARAM_FRAMEINB_ROT:
590 valueQuaternion = (OMV.Quaternion)setOps[opIndex + 1]; 619 valueQuaternion = (OMV.Quaternion)pParams[opIndex + 1];
591 linkInfo.frameInBrot = valueQuaternion; 620 linkInfo.frameInBrot = valueQuaternion;
621 opIndex += 2;
592 break; 622 break;
593 case ExtendedPhysics.PHYS_PARAM_LINEAR_LIMIT_LOW: 623 case ExtendedPhysics.PHYS_PARAM_LINEAR_LIMIT_LOW:
594 valueVector = (OMV.Vector3)setOps[opIndex + 1]; 624 valueVector = (OMV.Vector3)pParams[opIndex + 1];
595 linkInfo.linearLimitLow = valueVector; 625 linkInfo.linearLimitLow = valueVector;
626 opIndex += 2;
596 break; 627 break;
597 case ExtendedPhysics.PHYS_PARAM_LINEAR_LIMIT_HIGH: 628 case ExtendedPhysics.PHYS_PARAM_LINEAR_LIMIT_HIGH:
598 valueVector = (OMV.Vector3)setOps[opIndex + 1]; 629 valueVector = (OMV.Vector3)pParams[opIndex + 1];
599 linkInfo.linearLimitHigh = valueVector; 630 linkInfo.linearLimitHigh = valueVector;
631 opIndex += 2;
600 break; 632 break;
601 case ExtendedPhysics.PHYS_PARAM_ANGULAR_LIMIT_LOW: 633 case ExtendedPhysics.PHYS_PARAM_ANGULAR_LIMIT_LOW:
602 valueVector = (OMV.Vector3)setOps[opIndex + 1]; 634 valueVector = (OMV.Vector3)pParams[opIndex + 1];
603 linkInfo.angularLimitLow = valueVector; 635 linkInfo.angularLimitLow = valueVector;
636 opIndex += 2;
604 break; 637 break;
605 case ExtendedPhysics.PHYS_PARAM_ANGULAR_LIMIT_HIGH: 638 case ExtendedPhysics.PHYS_PARAM_ANGULAR_LIMIT_HIGH:
606 valueVector = (OMV.Vector3)setOps[opIndex + 1]; 639 valueVector = (OMV.Vector3)pParams[opIndex + 1];
607 linkInfo.angularLimitHigh = valueVector; 640 linkInfo.angularLimitHigh = valueVector;
641 opIndex += 2;
608 break; 642 break;
609 case ExtendedPhysics.PHYS_PARAM_USE_FRAME_OFFSET: 643 case ExtendedPhysics.PHYS_PARAM_USE_FRAME_OFFSET:
610 valueBool = (bool)setOps[opIndex + 1]; 644 valueBool = (bool)pParams[opIndex + 1];
611 linkInfo.useFrameOffset = valueBool; 645 linkInfo.useFrameOffset = valueBool;
646 opIndex += 2;
612 break; 647 break;
613 case ExtendedPhysics.PHYS_PARAM_ENABLE_TRANSMOTOR: 648 case ExtendedPhysics.PHYS_PARAM_ENABLE_TRANSMOTOR:
614 valueBool = (bool)setOps[opIndex + 1]; 649 valueBool = (bool)pParams[opIndex + 1];
615 linkInfo.enableTransMotor = valueBool; 650 linkInfo.enableTransMotor = valueBool;
651 opIndex += 2;
616 break; 652 break;
617 case ExtendedPhysics.PHYS_PARAM_TRANSMOTOR_MAXVEL: 653 case ExtendedPhysics.PHYS_PARAM_TRANSMOTOR_MAXVEL:
618 valueFloat = (float)setOps[opIndex + 1]; 654 valueFloat = (float)pParams[opIndex + 1];
619 linkInfo.transMotorMaxVel = valueFloat; 655 linkInfo.transMotorMaxVel = valueFloat;
656 opIndex += 2;
620 break; 657 break;
621 case ExtendedPhysics.PHYS_PARAM_TRANSMOTOR_MAXFORCE: 658 case ExtendedPhysics.PHYS_PARAM_TRANSMOTOR_MAXFORCE:
622 valueFloat = (float)setOps[opIndex + 1]; 659 valueFloat = (float)pParams[opIndex + 1];
623 linkInfo.transMotorMaxForce = valueFloat; 660 linkInfo.transMotorMaxForce = valueFloat;
661 opIndex += 2;
624 break; 662 break;
625 case ExtendedPhysics.PHYS_PARAM_CFM: 663 case ExtendedPhysics.PHYS_PARAM_CFM:
626 valueFloat = (float)setOps[opIndex + 1]; 664 valueFloat = (float)pParams[opIndex + 1];
627 linkInfo.cfm = valueFloat; 665 linkInfo.cfm = valueFloat;
666 opIndex += 2;
628 break; 667 break;
629 case ExtendedPhysics.PHYS_PARAM_ERP: 668 case ExtendedPhysics.PHYS_PARAM_ERP:
630 valueFloat = (float)setOps[opIndex + 1]; 669 valueFloat = (float)pParams[opIndex + 1];
631 linkInfo.erp = valueFloat; 670 linkInfo.erp = valueFloat;
671 opIndex += 2;
632 break; 672 break;
633 case ExtendedPhysics.PHYS_PARAM_SOLVER_ITERATIONS: 673 case ExtendedPhysics.PHYS_PARAM_SOLVER_ITERATIONS:
634 valueFloat = (float)setOps[opIndex + 1]; 674 valueFloat = (float)pParams[opIndex + 1];
635 linkInfo.solverIterations = valueFloat; 675 linkInfo.solverIterations = valueFloat;
676 opIndex += 2;
636 break; 677 break;
637 case ExtendedPhysics.PHYS_PARAM_SPRING_DAMPING: 678 case ExtendedPhysics.PHYS_PARAM_SPRING_DAMPING:
638 valueFloat = (float)setOps[opIndex + 1]; 679 valueFloat = (float)pParams[opIndex + 1];
639 linkInfo.springDamping = valueFloat; 680 linkInfo.springDamping = valueFloat;
681 opIndex += 2;
640 break; 682 break;
641 case ExtendedPhysics.PHYS_PARAM_SPRING_STIFFNESS: 683 case ExtendedPhysics.PHYS_PARAM_SPRING_STIFFNESS:
642 valueFloat = (float)setOps[opIndex + 1]; 684 valueFloat = (float)pParams[opIndex + 1];
643 linkInfo.springStiffness = valueFloat; 685 linkInfo.springStiffness = valueFloat;
686 opIndex += 2;
644 break; 687 break;
645 default: 688 default:
646 break; 689 break;
647 } 690 }
648 } 691 }
649 } 692 }
693 // Something changed so a rebuild is in order
694 Refresh(child);
650 } 695 }
651 } 696 }
652 } 697 }
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 4685b48..45056bc 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -1552,6 +1552,7 @@ public class BSPrim : BSPhysObject
1552 #region Extension 1552 #region Extension
1553 public override object Extension(string pFunct, params object[] pParams) 1553 public override object Extension(string pFunct, params object[] pParams)
1554 { 1554 {
1555 DetailLog("{0} BSPrim.Extension,op={1}", LocalID, pFunct);
1555 object ret = null; 1556 object ret = null;
1556 switch (pFunct) 1557 switch (pFunct)
1557 { 1558 {
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
index 28ea8c0..531f8fb 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
@@ -283,17 +283,20 @@ public class BSPrimLinkable : BSPrimDisplaced
283 #region Extension 283 #region Extension
284 public override object Extension(string pFunct, params object[] pParams) 284 public override object Extension(string pFunct, params object[] pParams)
285 { 285 {
286 DetailLog("{0} BSPrimLinkable.Extension,op={1},nParam={2}", LocalID, pFunct, pParams.Length);
286 object ret = null; 287 object ret = null;
287 switch (pFunct) 288 switch (pFunct)
288 { 289 {
289 // physGetLinksetType(); 290 // physGetLinksetType();
291 // pParams = []
290 case ExtendedPhysics.PhysFunctGetLinksetType: 292 case ExtendedPhysics.PhysFunctGetLinksetType:
291 { 293 {
292 ret = (object)LinksetType; 294 ret = (object)LinksetType;
293 m_log.DebugFormat("{0} Extension.physGetLinksetType, type={1}", LogHeader, ret); 295 DetailLog("{0},BSPrimLinkable.Extension.physGetLinksetType,type={1}", LocalID, ret);
294 break; 296 break;
295 } 297 }
296 // physSetLinksetType(type); 298 // physSetLinksetType(type);
299 // pParams = [ BSPhysObject child, integer type ]
297 case ExtendedPhysics.PhysFunctSetLinksetType: 300 case ExtendedPhysics.PhysFunctSetLinksetType:
298 { 301 {
299 if (pParams.Length > 0) 302 if (pParams.Length > 0)
@@ -304,8 +307,8 @@ public class BSPrimLinkable : BSPrimDisplaced
304 PhysScene.TaintedObject("BSPrim.PhysFunctSetLinksetType", delegate() 307 PhysScene.TaintedObject("BSPrim.PhysFunctSetLinksetType", delegate()
305 { 308 {
306 // Cause the linkset type to change 309 // Cause the linkset type to change
307 m_log.DebugFormat("{0} Extension.physSetLinksetType, oldType={1}, newType={2}", 310 DetailLog("{0},BSPrimLinkable.Extension.physSetLinksetType, oldType={1},newType={2}",
308 LogHeader, Linkset.LinksetImpl, linksetType); 311 LocalID, Linkset.LinksetImpl, linksetType);
309 ConvertLinkset(linksetType); 312 ConvertLinkset(linksetType);
310 }); 313 });
311 } 314 }
@@ -314,21 +317,21 @@ public class BSPrimLinkable : BSPrimDisplaced
314 break; 317 break;
315 } 318 }
316 // physChangeLinkType(linknum, typeCode); 319 // physChangeLinkType(linknum, typeCode);
317 // Params: PhysActor linkedPrim, int typeCode 320 // pParams = [ BSPhysObject child, integer linkType ]
318 case ExtendedPhysics.PhysFunctChangeLinkType: 321 case ExtendedPhysics.PhysFunctChangeLinkType:
319 { 322 {
320 ret = Linkset.Extension(pFunct, pParams); 323 ret = Linkset.Extension(pFunct, pParams);
321 break; 324 break;
322 } 325 }
323 // physGetLinkType(linknum); 326 // physGetLinkType(linknum);
324 // Params: PhysActor linkedPrim 327 // pParams = [ BSPhysObject child ]
325 case ExtendedPhysics.PhysFunctGetLinkType: 328 case ExtendedPhysics.PhysFunctGetLinkType:
326 { 329 {
327 ret = Linkset.Extension(pFunct, pParams); 330 ret = Linkset.Extension(pFunct, pParams);
328 break; 331 break;
329 } 332 }
330 // physChangeLinkParams(linknum, [code, value, code, value, ...]); 333 // physChangeLinkParams(linknum, [code, value, code, value, ...]);
331 // Params: PhysActor linkedPrim, object[] params 334 // pParams = [ BSPhysObject child, object[] [ string op, object opParam, string op, object opParam, ... ] ]
332 case ExtendedPhysics.PhysFunctChangeLinkParams: 335 case ExtendedPhysics.PhysFunctChangeLinkParams:
333 { 336 {
334 ret = Linkset.Extension(pFunct, pParams); 337 ret = Linkset.Extension(pFunct, pParams);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 7440468..b2ec0e5 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -869,6 +869,7 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
869 #region Extensions 869 #region Extensions
870 public override object Extension(string pFunct, params object[] pParams) 870 public override object Extension(string pFunct, params object[] pParams)
871 { 871 {
872 DetailLog("{0} BSScene.Extension,op={1}", DetailLogZero, pFunct);
872 return base.Extension(pFunct, pParams); 873 return base.Extension(pFunct, pParams);
873 } 874 }
874 #endregion // Extensions 875 #endregion // Extensions