aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2013-08-09 10:59:10 -0700
committerRobert Adams2013-09-11 09:11:52 -0700
commit455d36c4c70a55c5d48dc1410b8729929fafedf6 (patch)
tree2dad264f9a7c319cba213cfe486b38c6b0dca182 /OpenSim/Region/Physics
parentBulletSim: update C++ HACD parameters to values that handle enclosed hollow s... (diff)
downloadopensim-SC-455d36c4c70a55c5d48dc1410b8729929fafedf6.zip
opensim-SC-455d36c4c70a55c5d48dc1410b8729929fafedf6.tar.gz
opensim-SC-455d36c4c70a55c5d48dc1410b8729929fafedf6.tar.bz2
opensim-SC-455d36c4c70a55c5d48dc1410b8729929fafedf6.tar.xz
BulletSim: add physChangeLinkParams to set individual parameters on link constraints. Not fully functional. Remove double definition of ExtendedPhysics parameters by having BulletSim reference the optional module (addition to prebuild.xml and usings).
Diffstat (limited to 'OpenSim/Region/Physics')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs54
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs55
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs85
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs18
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs14
5 files changed, 153 insertions, 73 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs
new file mode 100755
index 0000000..7a76a9a
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintConeTwist.cs
@@ -0,0 +1,54 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Text;
30using OpenMetaverse;
31
32namespace OpenSim.Region.Physics.BulletSPlugin
33{
34
35public sealed class BSConstraintConeTwist : BSConstraint
36{
37 public override ConstraintType Type { get { return ConstraintType.CONETWIST_CONSTRAINT_TYPE; } }
38
39 public BSConstraintConeTwist(BulletWorld world, BulletBody obj1, BulletBody obj2,
40 Vector3 frameInAloc, Quaternion frameInArot,
41 Vector3 frameInBloc, Quaternion frameInBrot,
42 bool disableCollisionsBetweenLinkedBodies)
43 : base(world)
44 {
45 m_body1 = obj1;
46 m_body2 = obj2;
47 m_constraint = PhysicsScene.PE.CreateConeTwistConstraint(world, obj1, obj2,
48 frameInAloc, frameInArot, frameInBloc, frameInBrot,
49 disableCollisionsBetweenLinkedBodies);
50 m_enabled = true;
51 }
52}
53
54}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs
new file mode 100755
index 0000000..37cfa07
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraintSlider.cs
@@ -0,0 +1,55 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyrightD
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27using System;
28using System.Collections.Generic;
29using System.Text;
30using OpenMetaverse;
31
32namespace OpenSim.Region.Physics.BulletSPlugin
33{
34
35public sealed class BSConstraintSlider : BSConstraint
36{
37 public override ConstraintType Type { get { return ConstraintType.SLIDER_CONSTRAINT_TYPE; } }
38
39 public BSConstraintSlider(BulletWorld world, BulletBody obj1, BulletBody obj2,
40 Vector3 frameInAloc, Quaternion frameInArot,
41 Vector3 frameInBloc, Quaternion frameInBrot,
42 bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies)
43 : base(world)
44 {
45 m_body1 = obj1;
46 m_body2 = obj2;
47 m_constraint = PhysicsScene.PE.CreateSliderConstraint(world, obj1, obj2,
48 frameInAloc, frameInArot, frameInBloc, frameInBrot,
49 useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies);
50 m_enabled = true;
51 }
52
53}
54
55}
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
index 17fec9d..c09dd42 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
@@ -28,6 +28,8 @@ using System;
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Text; 29using System.Text;
30 30
31using OpenSim.Region.OptionalModules.Scripting;
32
31using OMV = OpenMetaverse; 33using OMV = OpenMetaverse;
32 34
33namespace OpenSim.Region.Physics.BulletSPlugin 35namespace OpenSim.Region.Physics.BulletSPlugin
@@ -489,71 +491,46 @@ public sealed class BSLinksetConstraints : BSLinkset
489 switch (pFunct) 491 switch (pFunct)
490 { 492 {
491 // pParams = (int linkNUm, PhysActor linkChild) 493 // pParams = (int linkNUm, PhysActor linkChild)
492 case BSScene.PhysFunctChangeLinkFixed: 494 case ExtendedPhysics.PhysFunctChangeLinkType:
493 if (pParams.Length > 1) 495 if (pParams.Length > 1)
494 { 496 {
495 BSPrimLinkable child = pParams[1] as BSPrimLinkable; 497 int requestedType = (int)pParams[1];
496 if (child != null) 498 if (requestedType == (int)ConstraintType.FIXED_CONSTRAINT_TYPE
499 || requestedType == (int)ConstraintType.D6_CONSTRAINT_TYPE
500 || requestedType == (int)ConstraintType.D6_SPRING_CONSTRAINT_TYPE
501 || requestedType == (int)ConstraintType.HINGE_CONSTRAINT_TYPE
502 || requestedType == (int)ConstraintType.CONETWIST_CONSTRAINT_TYPE
503 || requestedType == (int)ConstraintType.SLIDER_CONSTRAINT_TYPE)
497 { 504 {
498 m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkFixed", delegate() 505 BSPrimLinkable child = pParams[0] as BSPrimLinkable;
506 if (child != null)
499 { 507 {
500 // Pick up all the constraints currently created. 508 m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkFixed", delegate()
501 RemoveDependencies(child);
502
503 BSLinkInfo linkInfo = null;
504 if (m_children.TryGetValue(child, out linkInfo))
505 { 509 {
506 BSLinkInfoConstraint linkInfoC = linkInfo as BSLinkInfoConstraint; 510 // Pick up all the constraints currently created.
507 if (linkInfoC != null) 511 RemoveDependencies(child);
508 {
509 // Setting to fixed is easy. The reset state is the fixed link configuration.
510 linkInfoC.ResetLink();
511 ret = (object)true;
512 }
513 }
514 // Cause the whole linkset to be rebuilt in post-taint time.
515 Refresh(child);
516 });
517 }
518 }
519 break;
520 case BSScene.PhysFunctChangeLinkSpring:
521 if (pParams.Length > 11)
522 {
523 BSPrimLinkable child = pParams[1] as BSPrimLinkable;
524 if (child != null)
525 {
526 m_physicsScene.TaintedObject("BSLinksetConstraint.PhysFunctChangeLinkFixed", delegate()
527 {
528 // Pick up all the constraints currently created.
529 RemoveDependencies(child);
530 512
531 BSLinkInfo linkInfo = null; 513 BSLinkInfo linkInfo = null;
532 if (m_children.TryGetValue(child, out linkInfo)) 514 if (m_children.TryGetValue(child, out linkInfo))
533 {
534 BSLinkInfoConstraint linkInfoC = linkInfo as BSLinkInfoConstraint;
535 if (linkInfoC != null)
536 { 515 {
537 // Start with a reset link definition 516 BSLinkInfoConstraint linkInfoC = linkInfo as BSLinkInfoConstraint;
538 linkInfoC.ResetLink(); 517 if (linkInfoC != null)
539 linkInfoC.constraintType = ConstraintType.D6_SPRING_CONSTRAINT_TYPE; 518 {
540 linkInfoC.frameInAloc = (OMV.Vector3)pParams[2]; 519 // Setting to fixed is easy. The reset state is the fixed link configuration.
541 linkInfoC.frameInArot = (OMV.Quaternion)pParams[3]; 520 linkInfoC.ResetLink();
542 linkInfoC.frameInBloc = (OMV.Vector3)pParams[4]; 521 linkInfoC.constraintType = (ConstraintType)requestedType;
543 linkInfoC.frameInBrot = (OMV.Quaternion)pParams[5]; 522 ret = (object)true;
544 linkInfoC.linearLimitLow = (OMV.Vector3)pParams[6]; 523 }
545 linkInfoC.linearLimitHigh = (OMV.Vector3)pParams[7];
546 linkInfoC.angularLimitLow = (OMV.Vector3)pParams[8];
547 linkInfoC.angularLimitHigh = (OMV.Vector3)pParams[9];
548 ret = (object)true;
549 } 524 }
550 } 525 // Cause the whole linkset to be rebuilt in post-taint time.
551 // Cause the whole linkset to be rebuilt in post-taint time. 526 Refresh(child);
552 Refresh(child); 527 });
553 }); 528 }
554 } 529 }
555 } 530 }
556 break; 531 break;
532 case ExtendedPhysics.PhysFunctChangeLinkParams:
533 break;
557 default: 534 default:
558 ret = base.Extension(pFunct, pParams); 535 ret = base.Extension(pFunct, pParams);
559 break; 536 break;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
index 4c384a6..6136257 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs
@@ -30,6 +30,7 @@ using System.Linq;
30using System.Text; 30using System.Text;
31 31
32using OpenSim.Framework; 32using OpenSim.Framework;
33using OpenSim.Region.OptionalModules.Scripting;
33 34
34using OMV = OpenMetaverse; 35using OMV = OpenMetaverse;
35 36
@@ -286,14 +287,14 @@ public class BSPrimLinkable : BSPrimDisplaced
286 switch (pFunct) 287 switch (pFunct)
287 { 288 {
288 // physGetLinksetType(); 289 // physGetLinksetType();
289 case BSScene.PhysFunctGetLinksetType: 290 case ExtendedPhysics.PhysFunctGetLinksetType:
290 { 291 {
291 ret = (object)LinksetType; 292 ret = (object)LinksetType;
292 m_log.DebugFormat("{0} Extension.physGetLinksetType, type={1}", LogHeader, ret); 293 m_log.DebugFormat("{0} Extension.physGetLinksetType, type={1}", LogHeader, ret);
293 break; 294 break;
294 } 295 }
295 // physSetLinksetType(type); 296 // physSetLinksetType(type);
296 case BSScene.PhysFunctSetLinksetType: 297 case ExtendedPhysics.PhysFunctSetLinksetType:
297 { 298 {
298 if (pParams.Length > 0) 299 if (pParams.Length > 0)
299 { 300 {
@@ -312,9 +313,16 @@ public class BSPrimLinkable : BSPrimDisplaced
312 } 313 }
313 break; 314 break;
314 } 315 }
315 // physChangeLinkFixed(linknum); 316 // physChangeLinkType(linknum, typeCode);
316 // Params: int linkNum, PhysActor linkedPrim 317 // Params: PhysActor linkedPrim, int typeCode
317 case BSScene.PhysFunctChangeLinkFixed: 318 case ExtendedPhysics.PhysFunctChangeLinkType:
319 {
320 Linkset.Extension(pFunct, pParams);
321 break;
322 }
323 // physChangeLinkParams(linknum, [code, value, code, value, ...]);
324 // Params: PhysActor linkedPrim, object[] params
325 case ExtendedPhysics.PhysFunctChangeLinkParams:
318 { 326 {
319 Linkset.Extension(pFunct, pParams); 327 Linkset.Extension(pFunct, pParams);
320 break; 328 break;
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index 571db86..7440468 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -867,20 +867,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
867 public override bool IsThreaded { get { return false; } } 867 public override bool IsThreaded { get { return false; } }
868 868
869 #region Extensions 869 #region Extensions
870 // =============================================================
871 // Per scene functions. See below.
872
873 // Per avatar functions. See BSCharacter.
874
875 // Per prim functions. See BSPrim.
876 public const string PhysFunctGetLinksetType = "BulletSim.GetLinksetType";
877 public const string PhysFunctSetLinksetType = "BulletSim.SetLinksetType";
878 public const string PhysFunctChangeLinkFixed = "BulletSim.ChangeLinkFixed";
879 public const string PhysFunctChangeLinkHinge = "BulletSim.ChangeLinkHinge";
880 public const string PhysFunctChangeLinkSpring = "BulletSim.ChangeLinkSpring";
881 public const string PhysFunctChangeLinkSlider = "BulletSim.ChangeLinkSlider";
882 // =============================================================
883
884 public override object Extension(string pFunct, params object[] pParams) 870 public override object Extension(string pFunct, params object[] pParams)
885 { 871 {
886 return base.Extension(pFunct, pParams); 872 return base.Extension(pFunct, pParams);