diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs index 476a0e5..7fcb75c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSConstraint6Dof.cs | |||
@@ -32,12 +32,19 @@ using OpenMetaverse; | |||
32 | namespace OpenSim.Region.Physics.BulletSPlugin | 32 | namespace OpenSim.Region.Physics.BulletSPlugin |
33 | { | 33 | { |
34 | 34 | ||
35 | public sealed class BSConstraint6Dof : BSConstraint | 35 | public class BSConstraint6Dof : BSConstraint |
36 | { | 36 | { |
37 | private static string LogHeader = "[BULLETSIM 6DOF CONSTRAINT]"; | 37 | private static string LogHeader = "[BULLETSIM 6DOF CONSTRAINT]"; |
38 | 38 | ||
39 | public override ConstraintType Type { get { return ConstraintType.D6_CONSTRAINT_TYPE; } } | 39 | public override ConstraintType Type { get { return ConstraintType.D6_CONSTRAINT_TYPE; } } |
40 | 40 | ||
41 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2) :base(world) | ||
42 | { | ||
43 | m_body1 = obj1; | ||
44 | m_body2 = obj2; | ||
45 | m_enabled = false; | ||
46 | } | ||
47 | |||
41 | // Create a btGeneric6DofConstraint | 48 | // Create a btGeneric6DofConstraint |
42 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2, | 49 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, BulletBody obj2, |
43 | Vector3 frame1, Quaternion frame1rot, | 50 | Vector3 frame1, Quaternion frame1rot, |
@@ -52,9 +59,11 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
52 | frame2, frame2rot, | 59 | frame2, frame2rot, |
53 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); | 60 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); |
54 | m_enabled = true; | 61 | m_enabled = true; |
55 | 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}", |
56 | BSScene.DetailLogZero, world.worldID, | 63 | m_body1.ID, world.worldID, |
57 | 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); | ||
58 | } | 67 | } |
59 | 68 | ||
60 | // 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 |
@@ -79,9 +88,11 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
79 | m_constraint = PhysicsScene.PE.Create6DofConstraintToPoint(m_world, m_body1, m_body2, | 88 | m_constraint = PhysicsScene.PE.Create6DofConstraintToPoint(m_world, m_body1, m_body2, |
80 | joinPoint, | 89 | joinPoint, |
81 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); | 90 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); |
91 | |||
82 | 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}", |
83 | BSScene.DetailLogZero, world.worldID, m_constraint.AddrString, | 93 | m_body1.ID, world.worldID, m_constraint.AddrString, |
84 | obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); | 94 | obj1.ID, obj1.AddrString, obj2.ID, obj2.AddrString); |
95 | |||
85 | if (!m_constraint.HasPhysicalConstraint) | 96 | if (!m_constraint.HasPhysicalConstraint) |
86 | { | 97 | { |
87 | 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}", |
@@ -97,17 +108,19 @@ public sealed class BSConstraint6Dof : BSConstraint | |||
97 | 108 | ||
98 | // A 6 Dof constraint that is fixed in the world and constrained to a on-the-fly created static object | 109 | // A 6 Dof constraint that is fixed in the world and constrained to a on-the-fly created static object |
99 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, Vector3 frameInBloc, Quaternion frameInBrot, | 110 | public BSConstraint6Dof(BulletWorld world, BulletBody obj1, Vector3 frameInBloc, Quaternion frameInBrot, |
100 | bool useLinearReferenceFrameA, bool disableCollisionsBetweenLinkedBodies) | 111 | bool useLinearReferenceFrameB, bool disableCollisionsBetweenLinkedBodies) |
101 | : base(world) | 112 | : base(world) |
102 | { | 113 | { |
103 | m_body1 = obj1; | 114 | m_body1 = obj1; |
104 | m_body2 = obj1; // Look out for confusion down the road | 115 | m_body2 = obj1; // Look out for confusion down the road |
105 | m_constraint = PhysicsScene.PE.Create6DofConstraintFixed(m_world, m_body1, | 116 | m_constraint = PhysicsScene.PE.Create6DofConstraintFixed(m_world, m_body1, |
106 | frameInBloc, frameInBrot, | 117 | frameInBloc, frameInBrot, |
107 | useLinearReferenceFrameA, disableCollisionsBetweenLinkedBodies); | 118 | useLinearReferenceFrameB, disableCollisionsBetweenLinkedBodies); |
108 | m_enabled = true; | 119 | m_enabled = true; |
109 | world.physicsScene.DetailLog("{0},BS6DofConstraint,createFixed,wID={1},rID={2},rBody={3}", | 120 | PhysicsScene.DetailLog("{0},BS6DofConstraint,createFixed,wID={1},rID={2},rBody={3}", |
110 | 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); | ||
111 | } | 124 | } |
112 | 125 | ||
113 | public bool SetFrames(Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot) | 126 | public bool SetFrames(Vector3 frameA, Quaternion frameArot, Vector3 frameB, Quaternion frameBrot) |