aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs78
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs4
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs7
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs173
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs40
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs8
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs128
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSScene.cs20
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs46
9 files changed, 328 insertions, 176 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index b9013ab..8c7061d 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -131,45 +131,45 @@ public sealed class BSCharacter : BSPhysObject
131 DetailLog("{0},BSCharacter.Destroy", LocalID); 131 DetailLog("{0},BSCharacter.Destroy", LocalID);
132 PhysicsScene.TaintedObject("BSCharacter.destroy", delegate() 132 PhysicsScene.TaintedObject("BSCharacter.destroy", delegate()
133 { 133 {
134 PhysicsScene.Shapes.DereferenceBody(BSBody, true, null); 134 PhysicsScene.Shapes.DereferenceBody(PhysBody, true, null);
135 PhysicsScene.Shapes.DereferenceShape(BSShape, true, null); 135 PhysicsScene.Shapes.DereferenceShape(PhysShape, true, null);
136 }); 136 });
137 } 137 }
138 138
139 private void SetPhysicalProperties() 139 private void SetPhysicalProperties()
140 { 140 {
141 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, BSBody.ptr); 141 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
142 142
143 ZeroMotion(); 143 ZeroMotion();
144 ForcePosition = _position; 144 ForcePosition = _position;
145 // Set the velocity and compute the proper friction 145 // Set the velocity and compute the proper friction
146 ForceVelocity = _velocity; 146 ForceVelocity = _velocity;
147 147
148 BulletSimAPI.SetRestitution2(BSBody.ptr, PhysicsScene.Params.avatarRestitution); 148 BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.avatarRestitution);
149 BulletSimAPI.SetMargin2(BSShape.ptr, PhysicsScene.Params.collisionMargin); 149 BulletSimAPI.SetMargin2(PhysShape.ptr, PhysicsScene.Params.collisionMargin);
150 BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale); 150 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
151 BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold); 151 BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, PhysicsScene.Params.contactProcessingThreshold);
152 if (PhysicsScene.Params.ccdMotionThreshold > 0f) 152 if (PhysicsScene.Params.ccdMotionThreshold > 0f)
153 { 153 {
154 BulletSimAPI.SetCcdMotionThreshold2(BSBody.ptr, PhysicsScene.Params.ccdMotionThreshold); 154 BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, PhysicsScene.Params.ccdMotionThreshold);
155 BulletSimAPI.SetCcdSweptSphereRadius2(BSBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); 155 BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius);
156 } 156 }
157 157
158 UpdatePhysicalMassProperties(MassRaw); 158 UpdatePhysicalMassProperties(MassRaw);
159 159
160 // Make so capsule does not fall over 160 // Make so capsule does not fall over
161 BulletSimAPI.SetAngularFactorV2(BSBody.ptr, OMV.Vector3.Zero); 161 BulletSimAPI.SetAngularFactorV2(PhysBody.ptr, OMV.Vector3.Zero);
162 162
163 BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT); 163 BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_CHARACTER_OBJECT);
164 164
165 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr); 165 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
166 166
167 // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); 167 // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG);
168 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.DISABLE_DEACTIVATION); 168 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_DEACTIVATION);
169 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr); 169 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr);
170 170
171 // Do this after the object has been added to the world 171 // Do this after the object has been added to the world
172 BulletSimAPI.SetCollisionFilterMask2(BSBody.ptr, 172 BulletSimAPI.SetCollisionFilterMask2(PhysBody.ptr,
173 (uint)CollisionFilterGroups.AvatarFilter, 173 (uint)CollisionFilterGroups.AvatarFilter,
174 (uint)CollisionFilterGroups.AvatarMask); 174 (uint)CollisionFilterGroups.AvatarMask);
175 } 175 }
@@ -199,7 +199,7 @@ public sealed class BSCharacter : BSPhysObject
199 199
200 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate() 200 PhysicsScene.TaintedObject("BSCharacter.setSize", delegate()
201 { 201 {
202 BulletSimAPI.SetLocalScaling2(BSShape.ptr, Scale); 202 BulletSimAPI.SetLocalScaling2(PhysShape.ptr, Scale);
203 UpdatePhysicalMassProperties(MassRaw); 203 UpdatePhysicalMassProperties(MassRaw);
204 }); 204 });
205 205
@@ -234,10 +234,10 @@ public sealed class BSCharacter : BSPhysObject
234 _rotationalVelocity = OMV.Vector3.Zero; 234 _rotationalVelocity = OMV.Vector3.Zero;
235 235
236 // Zero some other properties directly into the physics engine 236 // Zero some other properties directly into the physics engine
237 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, OMV.Vector3.Zero); 237 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, OMV.Vector3.Zero);
238 BulletSimAPI.SetAngularVelocity2(BSBody.ptr, OMV.Vector3.Zero); 238 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, OMV.Vector3.Zero);
239 BulletSimAPI.SetInterpolationVelocity2(BSBody.ptr, OMV.Vector3.Zero, OMV.Vector3.Zero); 239 BulletSimAPI.SetInterpolationVelocity2(PhysBody.ptr, OMV.Vector3.Zero, OMV.Vector3.Zero);
240 BulletSimAPI.ClearForces2(BSBody.ptr); 240 BulletSimAPI.ClearForces2(PhysBody.ptr);
241 } 241 }
242 242
243 public override void LockAngularMotion(OMV.Vector3 axis) { return; } 243 public override void LockAngularMotion(OMV.Vector3 axis) { return; }
@@ -254,19 +254,19 @@ public sealed class BSCharacter : BSPhysObject
254 PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate() 254 PhysicsScene.TaintedObject("BSCharacter.setPosition", delegate()
255 { 255 {
256 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 256 DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
257 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 257 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
258 }); 258 });
259 } 259 }
260 } 260 }
261 public override OMV.Vector3 ForcePosition { 261 public override OMV.Vector3 ForcePosition {
262 get { 262 get {
263 _position = BulletSimAPI.GetPosition2(BSBody.ptr); 263 _position = BulletSimAPI.GetPosition2(PhysBody.ptr);
264 return _position; 264 return _position;
265 } 265 }
266 set { 266 set {
267 _position = value; 267 _position = value;
268 PositionSanityCheck(); 268 PositionSanityCheck();
269 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 269 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
270 } 270 }
271 } 271 }
272 272
@@ -313,7 +313,7 @@ public sealed class BSCharacter : BSPhysObject
313 BSScene.TaintCallback sanityOperation = delegate() 313 BSScene.TaintCallback sanityOperation = delegate()
314 { 314 {
315 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation); 315 DetailLog("{0},BSCharacter.PositionSanityCheck,taint,pos={1},orient={2}", LocalID, _position, _orientation);
316 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 316 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
317 }; 317 };
318 if (inTaintTime) 318 if (inTaintTime)
319 sanityOperation(); 319 sanityOperation();
@@ -332,8 +332,8 @@ public sealed class BSCharacter : BSPhysObject
332 } 332 }
333 public override void UpdatePhysicalMassProperties(float physMass) 333 public override void UpdatePhysicalMassProperties(float physMass)
334 { 334 {
335 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, physMass); 335 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass);
336 BulletSimAPI.SetMassProps2(BSBody.ptr, physMass, localInertia); 336 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia);
337 } 337 }
338 338
339 public override OMV.Vector3 Force { 339 public override OMV.Vector3 Force {
@@ -344,7 +344,7 @@ public sealed class BSCharacter : BSPhysObject
344 PhysicsScene.TaintedObject("BSCharacter.SetForce", delegate() 344 PhysicsScene.TaintedObject("BSCharacter.SetForce", delegate()
345 { 345 {
346 DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force); 346 DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force);
347 BulletSimAPI.SetObjectForce2(BSBody.ptr, _force); 347 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force);
348 }); 348 });
349 } 349 }
350 } 350 }
@@ -383,7 +383,7 @@ public sealed class BSCharacter : BSPhysObject
383 if (_currentFriction != PhysicsScene.Params.avatarStandingFriction) 383 if (_currentFriction != PhysicsScene.Params.avatarStandingFriction)
384 { 384 {
385 _currentFriction = PhysicsScene.Params.avatarStandingFriction; 385 _currentFriction = PhysicsScene.Params.avatarStandingFriction;
386 BulletSimAPI.SetFriction2(BSBody.ptr, _currentFriction); 386 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction);
387 } 387 }
388 } 388 }
389 else 389 else
@@ -391,15 +391,15 @@ public sealed class BSCharacter : BSPhysObject
391 if (_currentFriction != PhysicsScene.Params.avatarFriction) 391 if (_currentFriction != PhysicsScene.Params.avatarFriction)
392 { 392 {
393 _currentFriction = PhysicsScene.Params.avatarFriction; 393 _currentFriction = PhysicsScene.Params.avatarFriction;
394 BulletSimAPI.SetFriction2(BSBody.ptr, _currentFriction); 394 BulletSimAPI.SetFriction2(PhysBody.ptr, _currentFriction);
395 } 395 }
396 } 396 }
397 _velocity = value; 397 _velocity = value;
398 // Remember the set velocity so we can suppress the reduction by friction, ... 398 // Remember the set velocity so we can suppress the reduction by friction, ...
399 _appliedVelocity = value; 399 _appliedVelocity = value;
400 400
401 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, _velocity); 401 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity);
402 BulletSimAPI.Activate2(BSBody.ptr, true); 402 BulletSimAPI.Activate2(PhysBody.ptr, true);
403 } 403 }
404 } 404 }
405 public override OMV.Vector3 Torque { 405 public override OMV.Vector3 Torque {
@@ -424,7 +424,7 @@ public sealed class BSCharacter : BSPhysObject
424 PhysicsScene.TaintedObject("BSCharacter.setOrientation", delegate() 424 PhysicsScene.TaintedObject("BSCharacter.setOrientation", delegate()
425 { 425 {
426 // _position = BulletSimAPI.GetPosition2(BSBody.ptr); 426 // _position = BulletSimAPI.GetPosition2(BSBody.ptr);
427 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 427 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
428 }); 428 });
429 } 429 }
430 } 430 }
@@ -433,13 +433,13 @@ public sealed class BSCharacter : BSPhysObject
433 { 433 {
434 get 434 get
435 { 435 {
436 _orientation = BulletSimAPI.GetOrientation2(BSBody.ptr); 436 _orientation = BulletSimAPI.GetOrientation2(PhysBody.ptr);
437 return _orientation; 437 return _orientation;
438 } 438 }
439 set 439 set
440 { 440 {
441 _orientation = value; 441 _orientation = value;
442 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 442 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
443 } 443 }
444 } 444 }
445 public override int PhysicsActorType { 445 public override int PhysicsActorType {
@@ -498,9 +498,9 @@ public sealed class BSCharacter : BSPhysObject
498 PhysicsScene.TaintedObject("BSCharacter.setFloatOnWater", delegate() 498 PhysicsScene.TaintedObject("BSCharacter.setFloatOnWater", delegate()
499 { 499 {
500 if (_floatOnWater) 500 if (_floatOnWater)
501 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 501 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER);
502 else 502 else
503 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 503 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER);
504 }); 504 });
505 } 505 }
506 } 506 }
@@ -533,7 +533,7 @@ public sealed class BSCharacter : BSPhysObject
533 DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); 533 DetailLog("{0},BSCharacter.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
534 // Buoyancy is faked by changing the gravity applied to the object 534 // Buoyancy is faked by changing the gravity applied to the object
535 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); 535 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
536 BulletSimAPI.SetGravity2(BSBody.ptr, new OMV.Vector3(0f, 0f, grav)); 536 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav));
537 } 537 }
538 } 538 }
539 539
@@ -579,7 +579,7 @@ public sealed class BSCharacter : BSPhysObject
579 PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate() 579 PhysicsScene.TaintedObject("BSCharacter.AddForce", delegate()
580 { 580 {
581 DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force); 581 DetailLog("{0},BSCharacter.setAddForce,taint,addedForce={1}", LocalID, _force);
582 BulletSimAPI.SetObjectForce2(BSBody.ptr, _force); 582 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force);
583 }); 583 });
584 } 584 }
585 else 585 else
@@ -647,7 +647,7 @@ public sealed class BSCharacter : BSPhysObject
647 // That's just the way they are defined. 647 // That's just the way they are defined.
648 OMV.Vector3 avVel = new OMV.Vector3(_appliedVelocity.X, _appliedVelocity.Y, entprop.Velocity.Z); 648 OMV.Vector3 avVel = new OMV.Vector3(_appliedVelocity.X, _appliedVelocity.Y, entprop.Velocity.Z);
649 _velocity = avVel; 649 _velocity = avVel;
650 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, avVel); 650 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, avVel);
651 } 651 }
652 652
653 // Tell the linkset about value changes 653 // Tell the linkset about value changes
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 5c61774..38609e3 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -514,8 +514,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
514 if (IsActive) 514 if (IsActive)
515 { 515 {
516 // Friction effects are handled by this vehicle code 516 // Friction effects are handled by this vehicle code
517 BulletSimAPI.SetFriction2(Prim.BSBody.ptr, 0f); 517 BulletSimAPI.SetFriction2(Prim.PhysBody.ptr, 0f);
518 BulletSimAPI.SetHitFraction2(Prim.BSBody.ptr, 0f); 518 BulletSimAPI.SetHitFraction2(Prim.PhysBody.ptr, 0f);
519 } 519 }
520 } 520 }
521 521
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 6d84fcc..525ec28 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -194,13 +194,6 @@ public abstract class BSLinkset
194 // Called while LinkActivity is locked. 194 // Called while LinkActivity is locked.
195 protected abstract void AddChildToLinkset(BSPhysObject child); 195 protected abstract void AddChildToLinkset(BSPhysObject child);
196 196
197 // Forcefully removing a child from a linkset.
198 // This is not being called by the child so we have to make sure the child doesn't think
199 // it's still connected to the linkset.
200 // Normal OpenSimulator operation will never do this because other SceneObjectPart information
201 // also has to be updated (like pointer to prim's parent).
202 protected abstract void RemoveChildFromOtherLinkset(BSPhysObject pchild);
203
204 // I am the root of a linkset and one of my children is being removed. 197 // I am the root of a linkset and one of my children is being removed.
205 // Safe to call even if the child is not really in my linkset. 198 // Safe to call even if the child is not really in my linkset.
206 protected abstract void RemoveChildFromLinkset(BSPhysObject child); 199 protected abstract void RemoveChildFromLinkset(BSPhysObject child);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
new file mode 100755
index 0000000..1c569b5
--- /dev/null
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs
@@ -0,0 +1,173 @@
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;
30
31using OMV = OpenMetaverse;
32
33namespace OpenSim.Region.Physics.BulletSPlugin
34{
35public sealed class BSLinksetCompound : BSLinkset
36{
37 // private static string LogHeader = "[BULLETSIM LINKSET CONSTRAINTS]";
38
39 public BSLinksetCompound(BSScene scene, BSPhysObject parent)
40 {
41 base.Initialize(scene, parent);
42 }
43
44 // When physical properties are changed the linkset needs to recalculate
45 // its internal properties.
46 // This is queued in the 'post taint' queue so the
47 // refresh will happen once after all the other taints are applied.
48 public override void Refresh(BSPhysObject requestor)
49 {
50 // Queue to happen after all the other taint processing
51 PhysicsScene.PostTaintObject("BSLinksetcompound.Refresh", requestor.LocalID, delegate()
52 {
53 if (HasAnyChildren && IsRoot(requestor))
54 RecomputeLinksetCompound();
55 });
56 }
57
58 // The object is going dynamic (physical). Do any setup necessary
59 // for a dynamic linkset.
60 // Only the state of the passed object can be modified. The rest of the linkset
61 // has not yet been fully constructed.
62 // Return 'true' if any properties updated on the passed object.
63 // Called at taint-time!
64 public override bool MakeDynamic(BSPhysObject child)
65 {
66 // What is done for each object in BSPrim is what we want.
67 return false;
68 }
69
70 // The object is going static (non-physical). Do any setup necessary for a static linkset.
71 // Return 'true' if any properties updated on the passed object.
72 // This doesn't normally happen -- OpenSim removes the objects from the physical
73 // world if it is a static linkset.
74 // Called at taint-time!
75 public override bool MakeStatic(BSPhysObject child)
76 {
77 // What is done for each object in BSPrim is what we want.
78 return false;
79 }
80
81 // Called at taint-time!!
82 public override void UpdateProperties(BSPhysObject updated)
83 {
84 // Nothing to do for constraints on property updates
85 }
86
87 // Routine called when rebuilding the body of some member of the linkset.
88 // Destroy all the constraints have have been made to root and set
89 // up to rebuild the constraints before the next simulation step.
90 // Returns 'true' of something was actually removed and would need restoring
91 // Called at taint-time!!
92 public override bool RemoveBodyDependencies(BSPrim child)
93 {
94 bool ret = false;
95
96 DetailLog("{0},BSLinksetcompound.RemoveBodyDependencies,removeChildrenForRoot,rID={1},rBody={2}",
97 child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X"));
98
99 // Cause the current shape to be freed and the new one to be built.
100 Refresh(LinksetRoot);
101
102 return ret;
103 }
104
105 // Companion to RemoveBodyDependencies(). If RemoveBodyDependencies() returns 'true',
106 // this routine will restore the removed constraints.
107 // Called at taint-time!!
108 public override void RestoreBodyDependencies(BSPrim child)
109 {
110 // The Refresh operation queued by RemoveBodyDependencies() will build any missing constraints.
111 }
112
113 // ================================================================
114
115 // Add a new child to the linkset.
116 // Called while LinkActivity is locked.
117 protected override void AddChildToLinkset(BSPhysObject child)
118 {
119 if (!HasChild(child))
120 {
121 m_children.Add(child);
122
123 DetailLog("{0},BSLinksetCompound.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
124
125 // Cause constraints and assorted properties to be recomputed before the next simulation step.
126 Refresh(LinksetRoot);
127 }
128 return;
129 }
130
131 // Remove the specified child from the linkset.
132 // Safe to call even if the child is not really in my linkset.
133 protected override void RemoveChildFromLinkset(BSPhysObject child)
134 {
135 if (m_children.Remove(child))
136 {
137 DetailLog("{0},BSLinksetCompound.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}",
138 child.LocalID,
139 LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X"),
140 child.LocalID, child.PhysBody.ptr.ToString("X"));
141
142 // See that the linkset parameters are recomputed at the end of the taint time.
143 Refresh(LinksetRoot);
144 }
145 else
146 {
147 // Non-fatal occurance.
148 // PhysicsScene.Logger.ErrorFormat("{0}: Asked to remove child from linkset that was not in linkset", LogHeader);
149 }
150 return;
151 }
152
153
154 // Call each of the constraints that make up this linkset and recompute the
155 // various transforms and variables. Create constraints of not created yet.
156 // Called before the simulation step to make sure the constraint based linkset
157 // is all initialized.
158 // Called at taint time!!
159 private void RecomputeLinksetCompound()
160 {
161 float linksetMass = LinksetMass;
162 LinksetRoot.UpdatePhysicalMassProperties(linksetMass);
163
164 // DEBUG: see of inter-linkset collisions are causing problems
165 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr,
166 // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask);
167 DetailLog("{0},BSLinksetCompound.RecomputeLinksetCompound,set,rBody={1},linksetMass={2}",
168 LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X"), linksetMass);
169
170
171 }
172}
173} \ No newline at end of file
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
index 8cdbd9b..65aed77 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs
@@ -94,7 +94,7 @@ public sealed class BSLinksetConstraints : BSLinkset
94 bool ret = false; 94 bool ret = false;
95 95
96 DetailLog("{0},BSLinksetConstraint.RemoveBodyDependencies,removeChildrenForRoot,rID={1},rBody={2}", 96 DetailLog("{0},BSLinksetConstraint.RemoveBodyDependencies,removeChildrenForRoot,rID={1},rBody={2}",
97 child.LocalID, LinksetRoot.LocalID, LinksetRoot.BSBody.ptr.ToString("X")); 97 child.LocalID, LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X"));
98 98
99 lock (m_linksetActivityLock) 99 lock (m_linksetActivityLock)
100 { 100 {
@@ -124,9 +124,6 @@ public sealed class BSLinksetConstraints : BSLinkset
124 { 124 {
125 m_children.Add(child); 125 m_children.Add(child);
126 126
127 BSPhysObject rootx = LinksetRoot; // capture the root as of now
128 BSPhysObject childx = child;
129
130 DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID); 127 DetailLog("{0},BSLinksetConstraints.AddChildToLinkset,call,child={1}", LinksetRoot.LocalID, child.LocalID);
131 128
132 // Cause constraints and assorted properties to be recomputed before the next simulation step. 129 // Cause constraints and assorted properties to be recomputed before the next simulation step.
@@ -135,17 +132,6 @@ public sealed class BSLinksetConstraints : BSLinkset
135 return; 132 return;
136 } 133 }
137 134
138 // Forcefully removing a child from a linkset.
139 // This is not being called by the child so we have to make sure the child doesn't think
140 // it's still connected to the linkset.
141 // Normal OpenSimulator operation will never do this because other SceneObjectPart information
142 // also has to be updated (like pointer to prim's parent).
143 protected override void RemoveChildFromOtherLinkset(BSPhysObject pchild)
144 {
145 pchild.Linkset = BSLinkset.Factory(PhysicsScene, pchild);
146 RemoveChildFromLinkset(pchild);
147 }
148
149 // Remove the specified child from the linkset. 135 // Remove the specified child from the linkset.
150 // Safe to call even if the child is not really in my linkset. 136 // Safe to call even if the child is not really in my linkset.
151 protected override void RemoveChildFromLinkset(BSPhysObject child) 137 protected override void RemoveChildFromLinkset(BSPhysObject child)
@@ -157,8 +143,8 @@ public sealed class BSLinksetConstraints : BSLinkset
157 143
158 DetailLog("{0},BSLinksetConstraints.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}", 144 DetailLog("{0},BSLinksetConstraints.RemoveChildFromLinkset,call,rID={1},rBody={2},cID={3},cBody={4}",
159 childx.LocalID, 145 childx.LocalID,
160 rootx.LocalID, rootx.BSBody.ptr.ToString("X"), 146 rootx.LocalID, rootx.PhysBody.ptr.ToString("X"),
161 childx.LocalID, childx.BSBody.ptr.ToString("X")); 147 childx.LocalID, childx.PhysBody.ptr.ToString("X"));
162 148
163 PhysicsScene.TaintedObject("BSLinksetConstraints.RemoveChildFromLinkset", delegate() 149 PhysicsScene.TaintedObject("BSLinksetConstraints.RemoveChildFromLinkset", delegate()
164 { 150 {
@@ -197,15 +183,15 @@ public sealed class BSLinksetConstraints : BSLinkset
197 183
198 DetailLog("{0},BSLinksetConstraint.BuildConstraint,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}", 184 DetailLog("{0},BSLinksetConstraint.BuildConstraint,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}",
199 rootPrim.LocalID, 185 rootPrim.LocalID,
200 rootPrim.LocalID, rootPrim.BSBody.ptr.ToString("X"), 186 rootPrim.LocalID, rootPrim.PhysBody.ptr.ToString("X"),
201 childPrim.LocalID, childPrim.BSBody.ptr.ToString("X"), 187 childPrim.LocalID, childPrim.PhysBody.ptr.ToString("X"),
202 rootPrim.Position, childPrim.Position, midPoint); 188 rootPrim.Position, childPrim.Position, midPoint);
203 189
204 // create a constraint that allows no freedom of movement between the two objects 190 // create a constraint that allows no freedom of movement between the two objects
205 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818 191 // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818
206 192
207 BSConstraint6Dof constrain = new BSConstraint6Dof( 193 BSConstraint6Dof constrain = new BSConstraint6Dof(
208 PhysicsScene.World, rootPrim.BSBody, childPrim.BSBody, midPoint, true, true ); 194 PhysicsScene.World, rootPrim.PhysBody, childPrim.PhysBody, midPoint, true, true );
209 // PhysicsScene.World, childPrim.BSBody, rootPrim.BSBody, midPoint, true, true ); 195 // PhysicsScene.World, childPrim.BSBody, rootPrim.BSBody, midPoint, true, true );
210 196
211 /* NOTE: below is an attempt to build constraint with full frame computation, etc. 197 /* NOTE: below is an attempt to build constraint with full frame computation, etc.
@@ -262,14 +248,14 @@ public sealed class BSLinksetConstraints : BSLinkset
262 bool ret = false; 248 bool ret = false;
263 DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAChildFromRoot,taint,root={1},rBody={2},child={3},cBody={4}", 249 DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAChildFromRoot,taint,root={1},rBody={2},child={3},cBody={4}",
264 rootPrim.LocalID, 250 rootPrim.LocalID,
265 rootPrim.LocalID, rootPrim.BSBody.ptr.ToString("X"), 251 rootPrim.LocalID, rootPrim.PhysBody.ptr.ToString("X"),
266 childPrim.LocalID, childPrim.BSBody.ptr.ToString("X")); 252 childPrim.LocalID, childPrim.PhysBody.ptr.ToString("X"));
267 253
268 // Find the constraint for this link and get rid of it from the overall collection and from my list 254 // Find the constraint for this link and get rid of it from the overall collection and from my list
269 if (PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.BSBody, childPrim.BSBody)) 255 if (PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody, childPrim.PhysBody))
270 { 256 {
271 // Make the child refresh its location 257 // Make the child refresh its location
272 BulletSimAPI.PushUpdate2(childPrim.BSBody.ptr); 258 BulletSimAPI.PushUpdate2(childPrim.PhysBody.ptr);
273 ret = true; 259 ret = true;
274 } 260 }
275 261
@@ -283,7 +269,7 @@ public sealed class BSLinksetConstraints : BSLinkset
283 { 269 {
284 DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID); 270 DetailLog("{0},BSLinksetConstraint.PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID);
285 271
286 return PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.BSBody); 272 return PhysicsScene.Constraints.RemoveAndDestroyConstraint(rootPrim.PhysBody);
287 } 273 }
288 274
289 // Call each of the constraints that make up this linkset and recompute the 275 // Call each of the constraints that make up this linkset and recompute the
@@ -300,7 +286,7 @@ public sealed class BSLinksetConstraints : BSLinkset
300 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr, 286 // BulletSimAPI.SetCollisionFilterMask2(LinksetRoot.BSBody.ptr,
301 // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask); 287 // (uint)CollisionFilterGroups.LinksetFilter, (uint)CollisionFilterGroups.LinksetMask);
302 DetailLog("{0},BSLinksetConstraint.RecomputeLinksetConstraints,set,rBody={1},linksetMass={2}", 288 DetailLog("{0},BSLinksetConstraint.RecomputeLinksetConstraints,set,rBody={1},linksetMass={2}",
303 LinksetRoot.LocalID, LinksetRoot.BSBody.ptr.ToString("X"), linksetMass); 289 LinksetRoot.LocalID, LinksetRoot.PhysBody.ptr.ToString("X"), linksetMass);
304 290
305 foreach (BSPhysObject child in m_children) 291 foreach (BSPhysObject child in m_children)
306 { 292 {
@@ -310,7 +296,7 @@ public sealed class BSLinksetConstraints : BSLinkset
310 child.UpdatePhysicalMassProperties(linksetMass); 296 child.UpdatePhysicalMassProperties(linksetMass);
311 297
312 BSConstraint constrain; 298 BSConstraint constrain;
313 if (!PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.BSBody, child.BSBody, out constrain)) 299 if (!PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.PhysBody, child.PhysBody, out constrain))
314 { 300 {
315 // If constraint doesn't exist yet, create it. 301 // If constraint doesn't exist yet, create it.
316 constrain = BuildConstraint(LinksetRoot, child); 302 constrain = BuildConstraint(LinksetRoot, child);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index be8d64b..6220b21 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -68,9 +68,9 @@ public abstract class BSPhysObject : PhysicsActor
68 public abstract void UpdatePhysicalMassProperties(float mass); 68 public abstract void UpdatePhysicalMassProperties(float mass);
69 69
70 // Reference to the physical body (btCollisionObject) of this object 70 // Reference to the physical body (btCollisionObject) of this object
71 public BulletBody BSBody; 71 public BulletBody PhysBody;
72 // Reference to the physical shape (btCollisionShape) of this object 72 // Reference to the physical shape (btCollisionShape) of this object
73 public BulletShape BSShape; 73 public BulletShape PhysShape;
74 74
75 // 'true' if the mesh's underlying asset failed to build. 75 // 'true' if the mesh's underlying asset failed to build.
76 // This will keep us from looping after the first time the build failed. 76 // This will keep us from looping after the first time the build failed.
@@ -206,7 +206,7 @@ public abstract class BSPhysObject : PhysicsActor
206 206
207 PhysicsScene.TaintedObject(TypeName+".SubscribeEvents", delegate() 207 PhysicsScene.TaintedObject(TypeName+".SubscribeEvents", delegate()
208 { 208 {
209 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 209 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
210 }); 210 });
211 } 211 }
212 else 212 else
@@ -220,7 +220,7 @@ public abstract class BSPhysObject : PhysicsActor
220 SubscribedEventsMs = 0; 220 SubscribedEventsMs = 0;
221 PhysicsScene.TaintedObject(TypeName+".UnSubscribeEvents", delegate() 221 PhysicsScene.TaintedObject(TypeName+".UnSubscribeEvents", delegate()
222 { 222 {
223 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 223 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
224 }); 224 });
225 } 225 }
226 // Return 'true' if the simulator wants collision events 226 // Return 'true' if the simulator wants collision events
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 9ced61fa..8dd48ca 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -111,8 +111,8 @@ public sealed class BSPrim : BSPhysObject
111 _mass = CalculateMass(); 111 _mass = CalculateMass();
112 112
113 // No body or shape yet 113 // No body or shape yet
114 BSBody = new BulletBody(LocalID, IntPtr.Zero); 114 PhysBody = new BulletBody(LocalID, IntPtr.Zero);
115 BSShape = new BulletShape(IntPtr.Zero); 115 PhysShape = new BulletShape(IntPtr.Zero);
116 116
117 DetailLog("{0},BSPrim.constructor,call", LocalID); 117 DetailLog("{0},BSPrim.constructor,call", LocalID);
118 // do the actual object creation at taint time 118 // do the actual object creation at taint time
@@ -120,7 +120,7 @@ public sealed class BSPrim : BSPhysObject
120 { 120 {
121 CreateGeomAndObject(true); 121 CreateGeomAndObject(true);
122 122
123 CurrentCollisionFlags = BulletSimAPI.GetCollisionFlags2(BSBody.ptr); 123 CurrentCollisionFlags = BulletSimAPI.GetCollisionFlags2(PhysBody.ptr);
124 }); 124 });
125 } 125 }
126 126
@@ -145,8 +145,8 @@ public sealed class BSPrim : BSPhysObject
145 { 145 {
146 DetailLog("{0},BSPrim.Destroy,taint,", LocalID); 146 DetailLog("{0},BSPrim.Destroy,taint,", LocalID);
147 // If there are physical body and shape, release my use of same. 147 // If there are physical body and shape, release my use of same.
148 PhysicsScene.Shapes.DereferenceBody(BSBody, true, null); 148 PhysicsScene.Shapes.DereferenceBody(PhysBody, true, null);
149 PhysicsScene.Shapes.DereferenceShape(BSShape, true, null); 149 PhysicsScene.Shapes.DereferenceShape(PhysShape, true, null);
150 }); 150 });
151 } 151 }
152 152
@@ -243,7 +243,7 @@ public sealed class BSPrim : BSPhysObject
243 _rotationalVelocity = OMV.Vector3.Zero; 243 _rotationalVelocity = OMV.Vector3.Zero;
244 244
245 // Zero some other properties in the physics engine 245 // Zero some other properties in the physics engine
246 BulletSimAPI.ClearAllForces2(BSBody.ptr); 246 BulletSimAPI.ClearAllForces2(PhysBody.ptr);
247 } 247 }
248 248
249 public override void LockAngularMotion(OMV.Vector3 axis) 249 public override void LockAngularMotion(OMV.Vector3 axis)
@@ -256,7 +256,7 @@ public sealed class BSPrim : BSPhysObject
256 get { 256 get {
257 if (!Linkset.IsRoot(this)) 257 if (!Linkset.IsRoot(this))
258 // child prims move around based on their parent. Need to get the latest location 258 // child prims move around based on their parent. Need to get the latest location
259 _position = BulletSimAPI.GetPosition2(BSBody.ptr); 259 _position = BulletSimAPI.GetPosition2(PhysBody.ptr);
260 260
261 // don't do the GetObjectPosition for root elements because this function is called a zillion times 261 // don't do the GetObjectPosition for root elements because this function is called a zillion times
262 // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); 262 // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr);
@@ -274,20 +274,20 @@ public sealed class BSPrim : BSPhysObject
274 PhysicsScene.TaintedObject("BSPrim.setPosition", delegate() 274 PhysicsScene.TaintedObject("BSPrim.setPosition", delegate()
275 { 275 {
276 // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); 276 // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation);
277 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 277 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
278 ActivateIfPhysical(false); 278 ActivateIfPhysical(false);
279 }); 279 });
280 } 280 }
281 } 281 }
282 public override OMV.Vector3 ForcePosition { 282 public override OMV.Vector3 ForcePosition {
283 get { 283 get {
284 _position = BulletSimAPI.GetPosition2(BSBody.ptr); 284 _position = BulletSimAPI.GetPosition2(PhysBody.ptr);
285 return _position; 285 return _position;
286 } 286 }
287 set { 287 set {
288 _position = value; 288 _position = value;
289 PositionSanityCheck(); 289 PositionSanityCheck();
290 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 290 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
291 ActivateIfPhysical(false); 291 ActivateIfPhysical(false);
292 } 292 }
293 } 293 }
@@ -371,15 +371,15 @@ public sealed class BSPrim : BSPhysObject
371 { 371 {
372 if (IsStatic) 372 if (IsStatic)
373 { 373 {
374 BulletSimAPI.SetMassProps2(BSBody.ptr, 0f, OMV.Vector3.Zero); 374 BulletSimAPI.SetMassProps2(PhysBody.ptr, 0f, OMV.Vector3.Zero);
375 BulletSimAPI.UpdateInertiaTensor2(BSBody.ptr); 375 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr);
376 } 376 }
377 else 377 else
378 { 378 {
379 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(BSShape.ptr, physMass); 379 OMV.Vector3 localInertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass);
380 BulletSimAPI.SetMassProps2(BSBody.ptr, physMass, localInertia); 380 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, localInertia);
381 // center of mass is at the zero of the object 381 // center of mass is at the zero of the object
382 BulletSimAPI.SetCenterOfMassByPosRot2(BSBody.ptr, ForcePosition, ForceOrientation); 382 BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation);
383 // BulletSimAPI.UpdateInertiaTensor2(BSBody.ptr); 383 // BulletSimAPI.UpdateInertiaTensor2(BSBody.ptr);
384 DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2}", LocalID, physMass, localInertia); 384 DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2}", LocalID, physMass, localInertia);
385 } 385 }
@@ -404,7 +404,7 @@ public sealed class BSPrim : BSPhysObject
404 PhysicsScene.TaintedObject("BSPrim.setForce", delegate() 404 PhysicsScene.TaintedObject("BSPrim.setForce", delegate()
405 { 405 {
406 // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); 406 // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force);
407 BulletSimAPI.SetObjectForce2(BSBody.ptr, _force); 407 BulletSimAPI.SetObjectForce2(PhysBody.ptr, _force);
408 }); 408 });
409 } 409 }
410 } 410 }
@@ -498,7 +498,7 @@ public sealed class BSPrim : BSPhysObject
498 PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate() 498 PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate()
499 { 499 {
500 // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); 500 // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity);
501 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, _velocity); 501 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity);
502 }); 502 });
503 } 503 }
504 } 504 }
@@ -506,7 +506,7 @@ public sealed class BSPrim : BSPhysObject
506 get { return _velocity; } 506 get { return _velocity; }
507 set { 507 set {
508 _velocity = value; 508 _velocity = value;
509 BulletSimAPI.SetLinearVelocity2(BSBody.ptr, _velocity); 509 BulletSimAPI.SetLinearVelocity2(PhysBody.ptr, _velocity);
510 } 510 }
511 } 511 }
512 public override OMV.Vector3 Torque { 512 public override OMV.Vector3 Torque {
@@ -531,7 +531,7 @@ public sealed class BSPrim : BSPhysObject
531 if (!Linkset.IsRoot(this)) 531 if (!Linkset.IsRoot(this))
532 { 532 {
533 // Children move around because tied to parent. Get a fresh value. 533 // Children move around because tied to parent. Get a fresh value.
534 _orientation = BulletSimAPI.GetOrientation2(BSBody.ptr); 534 _orientation = BulletSimAPI.GetOrientation2(PhysBody.ptr);
535 } 535 }
536 return _orientation; 536 return _orientation;
537 } 537 }
@@ -544,7 +544,7 @@ public sealed class BSPrim : BSPhysObject
544 { 544 {
545 // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); 545 // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr);
546 // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); 546 // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation);
547 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 547 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
548 }); 548 });
549 } 549 }
550 } 550 }
@@ -553,13 +553,13 @@ public sealed class BSPrim : BSPhysObject
553 { 553 {
554 get 554 get
555 { 555 {
556 _orientation = BulletSimAPI.GetOrientation2(BSBody.ptr); 556 _orientation = BulletSimAPI.GetOrientation2(PhysBody.ptr);
557 return _orientation; 557 return _orientation;
558 } 558 }
559 set 559 set
560 { 560 {
561 _orientation = value; 561 _orientation = value;
562 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 562 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
563 } 563 }
564 } 564 }
565 public override int PhysicsActorType { 565 public override int PhysicsActorType {
@@ -615,7 +615,7 @@ public sealed class BSPrim : BSPhysObject
615 615
616 // Mangling all the physical properties requires the object not be in the physical world. 616 // Mangling all the physical properties requires the object not be in the physical world.
617 // This is a NOOP if the object is not in the world (BulletSim and Bullet ignore objects not found). 617 // This is a NOOP if the object is not in the world (BulletSim and Bullet ignore objects not found).
618 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, BSBody.ptr); 618 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
619 619
620 // Set up the object physicalness (does gravity and collisions move this object) 620 // Set up the object physicalness (does gravity and collisions move this object)
621 MakeDynamic(IsStatic); 621 MakeDynamic(IsStatic);
@@ -629,15 +629,15 @@ public sealed class BSPrim : BSPhysObject
629 // Make solid or not (do things bounce off or pass through this object). 629 // Make solid or not (do things bounce off or pass through this object).
630 MakeSolid(IsSolid); 630 MakeSolid(IsSolid);
631 631
632 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, BSBody.ptr); 632 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
633 633
634 // Rebuild its shape 634 // Rebuild its shape
635 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, BSBody.ptr); 635 BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, PhysBody.ptr);
636 636
637 // Collision filter can be set only when the object is in the world 637 // Collision filter can be set only when the object is in the world
638 if (BSBody.collisionFilter != 0 || BSBody.collisionMask != 0) 638 if (PhysBody.collisionFilter != 0 || PhysBody.collisionMask != 0)
639 { 639 {
640 BulletSimAPI.SetCollisionFilterMask2(BSBody.ptr, (uint)BSBody.collisionFilter, (uint)BSBody.collisionMask); 640 BulletSimAPI.SetCollisionFilterMask2(PhysBody.ptr, (uint)PhysBody.collisionFilter, (uint)PhysBody.collisionMask);
641 } 641 }
642 642
643 // Recompute any linkset parameters. 643 // Recompute any linkset parameters.
@@ -646,7 +646,7 @@ public sealed class BSPrim : BSPhysObject
646 Linkset.Refresh(this); 646 Linkset.Refresh(this);
647 647
648 DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}", 648 DetailLog("{0},BSPrim.UpdatePhysicalParameters,taintExit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}",
649 LocalID, IsStatic, IsSolid, _mass, SubscribedEvents(), CurrentCollisionFlags, BSBody, BSShape); 649 LocalID, IsStatic, IsSolid, _mass, SubscribedEvents(), CurrentCollisionFlags, PhysBody, PhysShape);
650 } 650 }
651 651
652 // "Making dynamic" means changing to and from static. 652 // "Making dynamic" means changing to and from static.
@@ -659,44 +659,44 @@ public sealed class BSPrim : BSPhysObject
659 if (makeStatic) 659 if (makeStatic)
660 { 660 {
661 // Become a Bullet 'static' object type 661 // Become a Bullet 'static' object type
662 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_STATIC_OBJECT); 662 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT);
663 // Stop all movement 663 // Stop all movement
664 ZeroMotion(); 664 ZeroMotion();
665 // Center of mass is at the center of the object 665 // Center of mass is at the center of the object
666 BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.BSBody.ptr, _position, _orientation); 666 BulletSimAPI.SetCenterOfMassByPosRot2(Linkset.LinksetRoot.PhysBody.ptr, _position, _orientation);
667 // Mass is zero which disables a bunch of physics stuff in Bullet 667 // Mass is zero which disables a bunch of physics stuff in Bullet
668 UpdatePhysicalMassProperties(0f); 668 UpdatePhysicalMassProperties(0f);
669 // Set collision detection parameters 669 // Set collision detection parameters
670 if (PhysicsScene.Params.ccdMotionThreshold > 0f) 670 if (PhysicsScene.Params.ccdMotionThreshold > 0f)
671 { 671 {
672 BulletSimAPI.SetCcdMotionThreshold2(BSBody.ptr, PhysicsScene.Params.ccdMotionThreshold); 672 BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, PhysicsScene.Params.ccdMotionThreshold);
673 BulletSimAPI.SetCcdSweptSphereRadius2(BSBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); 673 BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius);
674 } 674 }
675 // There can be special things needed for implementing linksets 675 // There can be special things needed for implementing linksets
676 Linkset.MakeStatic(this); 676 Linkset.MakeStatic(this);
677 // The activation state is 'disabled' so Bullet will not try to act on it. 677 // The activation state is 'disabled' so Bullet will not try to act on it.
678 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.DISABLE_SIMULATION); 678 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.DISABLE_SIMULATION);
679 // Start it out sleeping and physical actions could wake it up. 679 // Start it out sleeping and physical actions could wake it up.
680 // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ISLAND_SLEEPING); 680 // BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ISLAND_SLEEPING);
681 681
682 BSBody.collisionFilter = CollisionFilterGroups.StaticObjectFilter; 682 PhysBody.collisionFilter = CollisionFilterGroups.StaticObjectFilter;
683 BSBody.collisionMask = CollisionFilterGroups.StaticObjectMask; 683 PhysBody.collisionMask = CollisionFilterGroups.StaticObjectMask;
684 } 684 }
685 else 685 else
686 { 686 {
687 // Not a Bullet static object 687 // Not a Bullet static object
688 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.CF_STATIC_OBJECT); 688 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_STATIC_OBJECT);
689 689
690 // Set various physical properties so internal dynamic properties will get computed correctly as they are set 690 // Set various physical properties so internal dynamic properties will get computed correctly as they are set
691 BulletSimAPI.SetFriction2(BSBody.ptr, PhysicsScene.Params.defaultFriction); 691 BulletSimAPI.SetFriction2(PhysBody.ptr, PhysicsScene.Params.defaultFriction);
692 BulletSimAPI.SetRestitution2(BSBody.ptr, PhysicsScene.Params.defaultRestitution); 692 BulletSimAPI.SetRestitution2(PhysBody.ptr, PhysicsScene.Params.defaultRestitution);
693 693
694 // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382 694 // per http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=3382
695 // Since this can be called multiple times, only zero forces when becoming physical 695 // Since this can be called multiple times, only zero forces when becoming physical
696 // BulletSimAPI.ClearAllForces2(BSBody.ptr); 696 // BulletSimAPI.ClearAllForces2(BSBody.ptr);
697 697
698 // For good measure, make sure the transform is set through to the motion state 698 // For good measure, make sure the transform is set through to the motion state
699 BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); 699 BulletSimAPI.SetTranslation2(PhysBody.ptr, _position, _orientation);
700 700
701 // A dynamic object has mass 701 // A dynamic object has mass
702 UpdatePhysicalMassProperties(MassRaw); 702 UpdatePhysicalMassProperties(MassRaw);
@@ -704,26 +704,26 @@ public sealed class BSPrim : BSPhysObject
704 // Set collision detection parameters 704 // Set collision detection parameters
705 if (PhysicsScene.Params.ccdMotionThreshold > 0f) 705 if (PhysicsScene.Params.ccdMotionThreshold > 0f)
706 { 706 {
707 BulletSimAPI.SetCcdMotionThreshold2(BSBody.ptr, PhysicsScene.Params.ccdMotionThreshold); 707 BulletSimAPI.SetCcdMotionThreshold2(PhysBody.ptr, PhysicsScene.Params.ccdMotionThreshold);
708 BulletSimAPI.SetCcdSweptSphereRadius2(BSBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius); 708 BulletSimAPI.SetCcdSweptSphereRadius2(PhysBody.ptr, PhysicsScene.Params.ccdSweptSphereRadius);
709 } 709 }
710 710
711 // Various values for simulation limits 711 // Various values for simulation limits
712 BulletSimAPI.SetDamping2(BSBody.ptr, PhysicsScene.Params.linearDamping, PhysicsScene.Params.angularDamping); 712 BulletSimAPI.SetDamping2(PhysBody.ptr, PhysicsScene.Params.linearDamping, PhysicsScene.Params.angularDamping);
713 BulletSimAPI.SetDeactivationTime2(BSBody.ptr, PhysicsScene.Params.deactivationTime); 713 BulletSimAPI.SetDeactivationTime2(PhysBody.ptr, PhysicsScene.Params.deactivationTime);
714 BulletSimAPI.SetSleepingThresholds2(BSBody.ptr, PhysicsScene.Params.linearSleepingThreshold, PhysicsScene.Params.angularSleepingThreshold); 714 BulletSimAPI.SetSleepingThresholds2(PhysBody.ptr, PhysicsScene.Params.linearSleepingThreshold, PhysicsScene.Params.angularSleepingThreshold);
715 BulletSimAPI.SetContactProcessingThreshold2(BSBody.ptr, PhysicsScene.Params.contactProcessingThreshold); 715 BulletSimAPI.SetContactProcessingThreshold2(PhysBody.ptr, PhysicsScene.Params.contactProcessingThreshold);
716 716
717 // There might be special things needed for implementing linksets. 717 // There might be special things needed for implementing linksets.
718 Linkset.MakeDynamic(this); 718 Linkset.MakeDynamic(this);
719 719
720 // Force activation of the object so Bullet will act on it. 720 // Force activation of the object so Bullet will act on it.
721 // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects. 721 // Must do the ForceActivationState2() to overcome the DISABLE_SIMULATION from static objects.
722 BulletSimAPI.ForceActivationState2(BSBody.ptr, ActivationState.ACTIVE_TAG); 722 BulletSimAPI.ForceActivationState2(PhysBody.ptr, ActivationState.ACTIVE_TAG);
723 // BulletSimAPI.Activate2(BSBody.ptr, true); 723 // BulletSimAPI.Activate2(BSBody.ptr, true);
724 724
725 BSBody.collisionFilter = CollisionFilterGroups.ObjectFilter; 725 PhysBody.collisionFilter = CollisionFilterGroups.ObjectFilter;
726 BSBody.collisionMask = CollisionFilterGroups.ObjectMask; 726 PhysBody.collisionMask = CollisionFilterGroups.ObjectMask;
727 } 727 }
728 } 728 }
729 729
@@ -733,7 +733,7 @@ public sealed class BSPrim : BSPhysObject
733 // the functions after this one set up the state of a possibly newly created collision body. 733 // the functions after this one set up the state of a possibly newly created collision body.
734 private void MakeSolid(bool makeSolid) 734 private void MakeSolid(bool makeSolid)
735 { 735 {
736 CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(BSBody.ptr); 736 CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(PhysBody.ptr);
737 if (makeSolid) 737 if (makeSolid)
738 { 738 {
739 // Verify the previous code created the correct shape for this type of thing. 739 // Verify the previous code created the correct shape for this type of thing.
@@ -741,7 +741,7 @@ public sealed class BSPrim : BSPhysObject
741 { 741 {
742 m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for solidity. id={1}, type={2}", LogHeader, LocalID, bodyType); 742 m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for solidity. id={1}, type={2}", LogHeader, LocalID, bodyType);
743 } 743 }
744 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 744 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE);
745 } 745 }
746 else 746 else
747 { 747 {
@@ -749,9 +749,9 @@ public sealed class BSPrim : BSPhysObject
749 { 749 {
750 m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType); 750 m_log.ErrorFormat("{0} MakeSolid: physical body of wrong type for non-solidness. id={1}, type={2}", LogHeader, LocalID, bodyType);
751 } 751 }
752 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE); 752 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.CF_NO_CONTACT_RESPONSE);
753 BSBody.collisionFilter = CollisionFilterGroups.VolumeDetectFilter; 753 PhysBody.collisionFilter = CollisionFilterGroups.VolumeDetectFilter;
754 BSBody.collisionMask = CollisionFilterGroups.VolumeDetectMask; 754 PhysBody.collisionMask = CollisionFilterGroups.VolumeDetectMask;
755 } 755 }
756 } 756 }
757 757
@@ -761,7 +761,7 @@ public sealed class BSPrim : BSPhysObject
761 private void ActivateIfPhysical(bool forceIt) 761 private void ActivateIfPhysical(bool forceIt)
762 { 762 {
763 if (IsPhysical) 763 if (IsPhysical)
764 BulletSimAPI.Activate2(BSBody.ptr, forceIt); 764 BulletSimAPI.Activate2(PhysBody.ptr, forceIt);
765 } 765 }
766 766
767 // Turn on or off the flag controlling whether collision events are returned to the simulator. 767 // Turn on or off the flag controlling whether collision events are returned to the simulator.
@@ -769,11 +769,11 @@ public sealed class BSPrim : BSPhysObject
769 { 769 {
770 if (wantsCollisionEvents) 770 if (wantsCollisionEvents)
771 { 771 {
772 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 772 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
773 } 773 }
774 else 774 else
775 { 775 {
776 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS); 776 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_SUBSCRIBE_COLLISION_EVENTS);
777 } 777 }
778 } 778 }
779 779
@@ -818,9 +818,9 @@ public sealed class BSPrim : BSPhysObject
818 PhysicsScene.TaintedObject("BSPrim.setFloatOnWater", delegate() 818 PhysicsScene.TaintedObject("BSPrim.setFloatOnWater", delegate()
819 { 819 {
820 if (_floatOnWater) 820 if (_floatOnWater)
821 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(BSBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 821 CurrentCollisionFlags = BulletSimAPI.AddToCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER);
822 else 822 else
823 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(BSBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER); 823 CurrentCollisionFlags = BulletSimAPI.RemoveFromCollisionFlags2(PhysBody.ptr, CollisionFlags.BS_FLOATS_ON_WATER);
824 }); 824 });
825 } 825 }
826 } 826 }
@@ -843,7 +843,7 @@ public sealed class BSPrim : BSPhysObject
843 PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate() 843 PhysicsScene.TaintedObject("BSPrim.setRotationalVelocity", delegate()
844 { 844 {
845 DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); 845 DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity);
846 BulletSimAPI.SetAngularVelocity2(BSBody.ptr, _rotationalVelocity); 846 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
847 }); 847 });
848 } 848 }
849 } 849 }
@@ -853,7 +853,7 @@ public sealed class BSPrim : BSPhysObject
853 } 853 }
854 set { 854 set {
855 _rotationalVelocity = value; 855 _rotationalVelocity = value;
856 BulletSimAPI.SetAngularVelocity2(BSBody.ptr, _rotationalVelocity); 856 BulletSimAPI.SetAngularVelocity2(PhysBody.ptr, _rotationalVelocity);
857 } 857 }
858 } 858 }
859 public override bool Kinematic { 859 public override bool Kinematic {
@@ -879,7 +879,7 @@ public sealed class BSPrim : BSPhysObject
879 // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy); 879 // DetailLog("{0},BSPrim.setForceBuoyancy,taint,buoy={1}", LocalID, _buoyancy);
880 // Buoyancy is faked by changing the gravity applied to the object 880 // Buoyancy is faked by changing the gravity applied to the object
881 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); 881 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
882 BulletSimAPI.SetGravity2(BSBody.ptr, new OMV.Vector3(0f, 0f, grav)); 882 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav));
883 } 883 }
884 } 884 }
885 885
@@ -946,7 +946,7 @@ public sealed class BSPrim : BSPhysObject
946 } 946 }
947 DetailLog("{0},BSPrim.AddForce,taint,force={1}", LocalID, fSum); 947 DetailLog("{0},BSPrim.AddForce,taint,force={1}", LocalID, fSum);
948 if (fSum != OMV.Vector3.Zero) 948 if (fSum != OMV.Vector3.Zero)
949 BulletSimAPI.ApplyCentralForce2(BSBody.ptr, fSum); 949 BulletSimAPI.ApplyCentralForce2(PhysBody.ptr, fSum);
950 }; 950 };
951 if (inTaintTime) 951 if (inTaintTime)
952 addForceOperation(); 952 addForceOperation();
@@ -986,7 +986,7 @@ public sealed class BSPrim : BSPhysObject
986 DetailLog("{0},BSPrim.AddAngularForce,taint,aForce={1}", LocalID, fSum); 986 DetailLog("{0},BSPrim.AddAngularForce,taint,aForce={1}", LocalID, fSum);
987 if (fSum != OMV.Vector3.Zero) 987 if (fSum != OMV.Vector3.Zero)
988 { 988 {
989 BulletSimAPI.ApplyTorque2(BSBody.ptr, fSum); 989 BulletSimAPI.ApplyTorque2(PhysBody.ptr, fSum);
990 _torque = fSum; 990 _torque = fSum;
991 } 991 }
992 }; 992 };
@@ -1002,7 +1002,7 @@ public sealed class BSPrim : BSPhysObject
1002 BSScene.TaintCallback applyTorqueImpulseOperation = delegate() 1002 BSScene.TaintCallback applyTorqueImpulseOperation = delegate()
1003 { 1003 {
1004 DetailLog("{0},BSPrim.ApplyTorqueImpulse,taint,tImpulse={1}", LocalID, applyImpulse); 1004 DetailLog("{0},BSPrim.ApplyTorqueImpulse,taint,tImpulse={1}", LocalID, applyImpulse);
1005 BulletSimAPI.ApplyTorqueImpulse2(BSBody.ptr, applyImpulse); 1005 BulletSimAPI.ApplyTorqueImpulse2(PhysBody.ptr, applyImpulse);
1006 }; 1006 };
1007 if (inTaintTime) 1007 if (inTaintTime)
1008 applyTorqueImpulseOperation(); 1008 applyTorqueImpulseOperation();
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
index c27b5f0..cc5dbb2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs
@@ -1067,49 +1067,49 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
1067 (s,cf,p,v) => { s.m_params[0].linearDamping = cf.GetFloat(p, v); }, 1067 (s,cf,p,v) => { s.m_params[0].linearDamping = cf.GetFloat(p, v); },
1068 (s) => { return s.m_params[0].linearDamping; }, 1068 (s) => { return s.m_params[0].linearDamping; },
1069 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].linearDamping, p, l, v); }, 1069 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].linearDamping, p, l, v); },
1070 (s,o,v) => { BulletSimAPI.SetDamping2(o.BSBody.ptr, v, v); } ), 1070 (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, v, v); } ),
1071 new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)", 1071 new ParameterDefn("AngularDamping", "Factor to damp angular movement per second (0.0 - 1.0)",
1072 0f, 1072 0f,
1073 (s,cf,p,v) => { s.m_params[0].angularDamping = cf.GetFloat(p, v); }, 1073 (s,cf,p,v) => { s.m_params[0].angularDamping = cf.GetFloat(p, v); },
1074 (s) => { return s.m_params[0].angularDamping; }, 1074 (s) => { return s.m_params[0].angularDamping; },
1075 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].angularDamping, p, l, v); }, 1075 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].angularDamping, p, l, v); },
1076 (s,o,v) => { BulletSimAPI.SetDamping2(o.BSBody.ptr, v, v); } ), 1076 (s,o,v) => { BulletSimAPI.SetDamping2(o.PhysBody.ptr, v, v); } ),
1077 new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static", 1077 new ParameterDefn("DeactivationTime", "Seconds before considering an object potentially static",
1078 0.2f, 1078 0.2f,
1079 (s,cf,p,v) => { s.m_params[0].deactivationTime = cf.GetFloat(p, v); }, 1079 (s,cf,p,v) => { s.m_params[0].deactivationTime = cf.GetFloat(p, v); },
1080 (s) => { return s.m_params[0].deactivationTime; }, 1080 (s) => { return s.m_params[0].deactivationTime; },
1081 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].deactivationTime, p, l, v); }, 1081 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].deactivationTime, p, l, v); },
1082 (s,o,v) => { BulletSimAPI.SetDeactivationTime2(o.BSBody.ptr, v); } ), 1082 (s,o,v) => { BulletSimAPI.SetDeactivationTime2(o.PhysBody.ptr, v); } ),
1083 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static", 1083 new ParameterDefn("LinearSleepingThreshold", "Seconds to measure linear movement before considering static",
1084 0.8f, 1084 0.8f,
1085 (s,cf,p,v) => { s.m_params[0].linearSleepingThreshold = cf.GetFloat(p, v); }, 1085 (s,cf,p,v) => { s.m_params[0].linearSleepingThreshold = cf.GetFloat(p, v); },
1086 (s) => { return s.m_params[0].linearSleepingThreshold; }, 1086 (s) => { return s.m_params[0].linearSleepingThreshold; },
1087 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].linearSleepingThreshold, p, l, v); }, 1087 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].linearSleepingThreshold, p, l, v); },
1088 (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.BSBody.ptr, v, v); } ), 1088 (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ),
1089 new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static", 1089 new ParameterDefn("AngularSleepingThreshold", "Seconds to measure angular movement before considering static",
1090 1.0f, 1090 1.0f,
1091 (s,cf,p,v) => { s.m_params[0].angularSleepingThreshold = cf.GetFloat(p, v); }, 1091 (s,cf,p,v) => { s.m_params[0].angularSleepingThreshold = cf.GetFloat(p, v); },
1092 (s) => { return s.m_params[0].angularSleepingThreshold; }, 1092 (s) => { return s.m_params[0].angularSleepingThreshold; },
1093 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].angularSleepingThreshold, p, l, v); }, 1093 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].angularSleepingThreshold, p, l, v); },
1094 (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.BSBody.ptr, v, v); } ), 1094 (s,o,v) => { BulletSimAPI.SetSleepingThresholds2(o.PhysBody.ptr, v, v); } ),
1095 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" , 1095 new ParameterDefn("CcdMotionThreshold", "Continuious collision detection threshold (0 means no CCD)" ,
1096 0f, // set to zero to disable 1096 0f, // set to zero to disable
1097 (s,cf,p,v) => { s.m_params[0].ccdMotionThreshold = cf.GetFloat(p, v); }, 1097 (s,cf,p,v) => { s.m_params[0].ccdMotionThreshold = cf.GetFloat(p, v); },
1098 (s) => { return s.m_params[0].ccdMotionThreshold; }, 1098 (s) => { return s.m_params[0].ccdMotionThreshold; },
1099 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].ccdMotionThreshold, p, l, v); }, 1099 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].ccdMotionThreshold, p, l, v); },
1100 (s,o,v) => { BulletSimAPI.SetCcdMotionThreshold2(o.BSBody.ptr, v); } ), 1100 (s,o,v) => { BulletSimAPI.SetCcdMotionThreshold2(o.PhysBody.ptr, v); } ),
1101 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" , 1101 new ParameterDefn("CcdSweptSphereRadius", "Continuious collision detection test radius" ,
1102 0f, 1102 0f,
1103 (s,cf,p,v) => { s.m_params[0].ccdSweptSphereRadius = cf.GetFloat(p, v); }, 1103 (s,cf,p,v) => { s.m_params[0].ccdSweptSphereRadius = cf.GetFloat(p, v); },
1104 (s) => { return s.m_params[0].ccdSweptSphereRadius; }, 1104 (s) => { return s.m_params[0].ccdSweptSphereRadius; },
1105 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].ccdSweptSphereRadius, p, l, v); }, 1105 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].ccdSweptSphereRadius, p, l, v); },
1106 (s,o,v) => { BulletSimAPI.SetCcdSweptSphereRadius2(o.BSBody.ptr, v); } ), 1106 (s,o,v) => { BulletSimAPI.SetCcdSweptSphereRadius2(o.PhysBody.ptr, v); } ),
1107 new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" , 1107 new ParameterDefn("ContactProcessingThreshold", "Distance between contacts before doing collision check" ,
1108 0.1f, 1108 0.1f,
1109 (s,cf,p,v) => { s.m_params[0].contactProcessingThreshold = cf.GetFloat(p, v); }, 1109 (s,cf,p,v) => { s.m_params[0].contactProcessingThreshold = cf.GetFloat(p, v); },
1110 (s) => { return s.m_params[0].contactProcessingThreshold; }, 1110 (s) => { return s.m_params[0].contactProcessingThreshold; },
1111 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].contactProcessingThreshold, p, l, v); }, 1111 (s,p,l,v) => { s.UpdateParameterObject(ref s.m_params[0].contactProcessingThreshold, p, l, v); },
1112 (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.BSBody.ptr, v); } ), 1112 (s,o,v) => { BulletSimAPI.SetContactProcessingThreshold2(o.PhysBody.ptr, v); } ),
1113 1113
1114 new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" , 1114 new ParameterDefn("TerrainFriction", "Factor to reduce movement against terrain surface" ,
1115 0.5f, 1115 0.5f,
@@ -1428,8 +1428,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters
1428 { 1428 {
1429 foreach (BSPrim prim in m_vehicles) 1429 foreach (BSPrim prim in m_vehicles)
1430 { 1430 {
1431 BulletSimAPI.DumpRigidBody2(World.ptr, prim.BSBody.ptr); 1431 BulletSimAPI.DumpRigidBody2(World.ptr, prim.PhysBody.ptr);
1432 BulletSimAPI.DumpCollisionShape2(World.ptr, prim.BSShape.ptr); 1432 BulletSimAPI.DumpCollisionShape2(World.ptr, prim.PhysShape.ptr);
1433 } 1433 }
1434 } 1434 }
1435 1435
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index 1219fc0..a38e650 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -106,11 +106,11 @@ public sealed class BSShapeCollection : IDisposable
106 // rebuild the body around it. 106 // rebuild the body around it.
107 // Updates prim.BSBody with information/pointers to requested body 107 // Updates prim.BSBody with information/pointers to requested body
108 bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, 108 bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World,
109 prim.BSShape, shapeData, bodyCallback); 109 prim.PhysShape, shapeData, bodyCallback);
110 ret = newGeom || newBody; 110 ret = newGeom || newBody;
111 } 111 }
112 DetailLog("{0},BSShapeCollection.GetBodyAndShape,taintExit,force={1},ret={2},body={3},shape={4}", 112 DetailLog("{0},BSShapeCollection.GetBodyAndShape,taintExit,force={1},ret={2},body={3},shape={4}",
113 prim.LocalID, forceRebuild, ret, prim.BSBody, prim.BSShape); 113 prim.LocalID, forceRebuild, ret, prim.PhysBody, prim.PhysShape);
114 114
115 return ret; 115 return ret;
116 } 116 }
@@ -337,7 +337,7 @@ public sealed class BSShapeCollection : IDisposable
337 // an avatar capsule is close to a native shape (it is not shared) 337 // an avatar capsule is close to a native shape (it is not shared)
338 ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_AVATAR, 338 ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_AVATAR,
339 ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback); 339 ShapeData.FixedShapeKey.KEY_CAPSULE, shapeCallback);
340 DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.BSShape); 340 DetailLog("{0},BSShapeCollection.CreateGeom,avatarCapsule,shape={1}", prim.LocalID, prim.PhysShape);
341 ret = true; 341 ret = true;
342 haveShape = true; 342 haveShape = true;
343 } 343 }
@@ -360,13 +360,13 @@ public sealed class BSShapeCollection : IDisposable
360 haveShape = true; 360 haveShape = true;
361 if (forceRebuild 361 if (forceRebuild
362 || prim.Scale != shapeData.Size 362 || prim.Scale != shapeData.Size
363 || prim.BSShape.type != ShapeData.PhysicsShapeType.SHAPE_SPHERE 363 || prim.PhysShape.type != ShapeData.PhysicsShapeType.SHAPE_SPHERE
364 ) 364 )
365 { 365 {
366 ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_SPHERE, 366 ret = GetReferenceToNativeShape(prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_SPHERE,
367 ShapeData.FixedShapeKey.KEY_SPHERE, shapeCallback); 367 ShapeData.FixedShapeKey.KEY_SPHERE, shapeCallback);
368 DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}", 368 DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}",
369 prim.LocalID, forceRebuild, prim.BSShape); 369 prim.LocalID, forceRebuild, prim.PhysShape);
370 } 370 }
371 } 371 }
372 if (pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight) 372 if (pbs.ProfileShape == ProfileShape.Square && pbs.PathCurve == (byte)Extrusion.Straight)
@@ -374,13 +374,13 @@ public sealed class BSShapeCollection : IDisposable
374 haveShape = true; 374 haveShape = true;
375 if (forceRebuild 375 if (forceRebuild
376 || prim.Scale != shapeData.Size 376 || prim.Scale != shapeData.Size
377 || prim.BSShape.type != ShapeData.PhysicsShapeType.SHAPE_BOX 377 || prim.PhysShape.type != ShapeData.PhysicsShapeType.SHAPE_BOX
378 ) 378 )
379 { 379 {
380 ret = GetReferenceToNativeShape( prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_BOX, 380 ret = GetReferenceToNativeShape( prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_BOX,
381 ShapeData.FixedShapeKey.KEY_BOX, shapeCallback); 381 ShapeData.FixedShapeKey.KEY_BOX, shapeCallback);
382 DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}", 382 DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}",
383 prim.LocalID, forceRebuild, prim.BSShape); 383 prim.LocalID, forceRebuild, prim.PhysShape);
384 } 384 }
385 } 385 }
386 } 386 }
@@ -394,13 +394,13 @@ public sealed class BSShapeCollection : IDisposable
394 // Update prim.BSShape to reference a hull of this shape. 394 // Update prim.BSShape to reference a hull of this shape.
395 ret = GetReferenceToHull(prim, shapeData, pbs, shapeCallback); 395 ret = GetReferenceToHull(prim, shapeData, pbs, shapeCallback);
396 DetailLog("{0},BSShapeCollection.CreateGeom,hull,shape={1},key={2}", 396 DetailLog("{0},BSShapeCollection.CreateGeom,hull,shape={1},key={2}",
397 shapeData.ID, prim.BSShape, prim.BSShape.shapeKey.ToString("X")); 397 shapeData.ID, prim.PhysShape, prim.PhysShape.shapeKey.ToString("X"));
398 } 398 }
399 else 399 else
400 { 400 {
401 ret = GetReferenceToMesh(prim, shapeData, pbs, shapeCallback); 401 ret = GetReferenceToMesh(prim, shapeData, pbs, shapeCallback);
402 DetailLog("{0},BSShapeCollection.CreateGeom,mesh,shape={1},key={2}", 402 DetailLog("{0},BSShapeCollection.CreateGeom,mesh,shape={1},key={2}",
403 shapeData.ID, prim.BSShape, prim.BSShape.shapeKey.ToString("X")); 403 shapeData.ID, prim.PhysShape, prim.PhysShape.shapeKey.ToString("X"));
404 } 404 }
405 } 405 }
406 return ret; 406 return ret;
@@ -413,7 +413,7 @@ public sealed class BSShapeCollection : IDisposable
413 ShapeDestructionCallback shapeCallback) 413 ShapeDestructionCallback shapeCallback)
414 { 414 {
415 // release any previous shape 415 // release any previous shape
416 DereferenceShape(prim.BSShape, true, shapeCallback); 416 DereferenceShape(prim.PhysShape, true, shapeCallback);
417 417
418 shapeData.Type = shapeType; 418 shapeData.Type = shapeType;
419 // Bullet native objects are scaled by the Bullet engine so pass the size in 419 // Bullet native objects are scaled by the Bullet engine so pass the size in
@@ -426,7 +426,7 @@ public sealed class BSShapeCollection : IDisposable
426 DetailLog("{0},BSShapeCollection.AddNativeShapeToPrim,create,newshape={1},scale={2}", 426 DetailLog("{0},BSShapeCollection.AddNativeShapeToPrim,create,newshape={1},scale={2}",
427 shapeData.ID, newShape, shapeData.Scale); 427 shapeData.ID, newShape, shapeData.Scale);
428 428
429 prim.BSShape = newShape; 429 prim.PhysShape = newShape;
430 return true; 430 return true;
431 } 431 }
432 432
@@ -475,14 +475,14 @@ public sealed class BSShapeCollection : IDisposable
475 System.UInt64 newMeshKey = ComputeShapeKey(shapeData, pbs, out lod); 475 System.UInt64 newMeshKey = ComputeShapeKey(shapeData, pbs, out lod);
476 476
477 // if this new shape is the same as last time, don't recreate the mesh 477 // if this new shape is the same as last time, don't recreate the mesh
478 if (newMeshKey == prim.BSShape.shapeKey && prim.BSShape.type == ShapeData.PhysicsShapeType.SHAPE_MESH) 478 if (newMeshKey == prim.PhysShape.shapeKey && prim.PhysShape.type == ShapeData.PhysicsShapeType.SHAPE_MESH)
479 return false; 479 return false;
480 480
481 DetailLog("{0},BSShapeCollection.CreateGeomMesh,create,oldKey={1},newKey={2}", 481 DetailLog("{0},BSShapeCollection.CreateGeomMesh,create,oldKey={1},newKey={2}",
482 prim.LocalID, prim.BSShape.shapeKey.ToString("X"), newMeshKey.ToString("X")); 482 prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newMeshKey.ToString("X"));
483 483
484 // Since we're recreating new, get rid of the reference to the previous shape 484 // Since we're recreating new, get rid of the reference to the previous shape
485 DereferenceShape(prim.BSShape, true, shapeCallback); 485 DereferenceShape(prim.PhysShape, true, shapeCallback);
486 486
487 newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, pbs, shapeData.Size, lod); 487 newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, pbs, shapeData.Size, lod);
488 // Take evasive action if the mesh was not constructed. 488 // Take evasive action if the mesh was not constructed.
@@ -492,7 +492,7 @@ public sealed class BSShapeCollection : IDisposable
492 492
493 // meshes are already scaled by the meshmerizer 493 // meshes are already scaled by the meshmerizer
494 prim.Scale = new OMV.Vector3(1f, 1f, 1f); 494 prim.Scale = new OMV.Vector3(1f, 1f, 1f);
495 prim.BSShape = newShape; 495 prim.PhysShape = newShape;
496 496
497 return true; // 'true' means a new shape has been added to this prim 497 return true; // 'true' means a new shape has been added to this prim
498 } 498 }
@@ -550,14 +550,14 @@ public sealed class BSShapeCollection : IDisposable
550 System.UInt64 newHullKey = ComputeShapeKey(shapeData, pbs, out lod); 550 System.UInt64 newHullKey = ComputeShapeKey(shapeData, pbs, out lod);
551 551
552 // if the hull hasn't changed, don't rebuild it 552 // if the hull hasn't changed, don't rebuild it
553 if (newHullKey == prim.BSShape.shapeKey && prim.BSShape.type == ShapeData.PhysicsShapeType.SHAPE_HULL) 553 if (newHullKey == prim.PhysShape.shapeKey && prim.PhysShape.type == ShapeData.PhysicsShapeType.SHAPE_HULL)
554 return false; 554 return false;
555 555
556 DetailLog("{0},BSShapeCollection.CreateGeomHull,create,oldKey={1},newKey={2}", 556 DetailLog("{0},BSShapeCollection.CreateGeomHull,create,oldKey={1},newKey={2}",
557 prim.LocalID, prim.BSShape.shapeKey.ToString("X"), newHullKey.ToString("X")); 557 prim.LocalID, prim.PhysShape.shapeKey.ToString("X"), newHullKey.ToString("X"));
558 558
559 // Remove usage of the previous shape. 559 // Remove usage of the previous shape.
560 DereferenceShape(prim.BSShape, true, shapeCallback); 560 DereferenceShape(prim.PhysShape, true, shapeCallback);
561 561
562 newShape = CreatePhysicalHull(prim.PhysObjectName, newHullKey, pbs, shapeData.Size, lod); 562 newShape = CreatePhysicalHull(prim.PhysObjectName, newHullKey, pbs, shapeData.Size, lod);
563 newShape = VerifyMeshCreated(newShape, prim, shapeData, pbs); 563 newShape = VerifyMeshCreated(newShape, prim, shapeData, pbs);
@@ -566,7 +566,7 @@ public sealed class BSShapeCollection : IDisposable
566 566
567 // hulls are already scaled by the meshmerizer 567 // hulls are already scaled by the meshmerizer
568 prim.Scale = new OMV.Vector3(1f, 1f, 1f); 568 prim.Scale = new OMV.Vector3(1f, 1f, 1f);
569 prim.BSShape = newShape; 569 prim.PhysShape = newShape;
570 return true; // 'true' means a new shape has been added to this prim 570 return true; // 'true' means a new shape has been added to this prim
571 } 571 }
572 572
@@ -778,13 +778,13 @@ public sealed class BSShapeCollection : IDisposable
778 bool ret = false; 778 bool ret = false;
779 779
780 // the mesh, hull or native shape must have already been created in Bullet 780 // the mesh, hull or native shape must have already been created in Bullet
781 bool mustRebuild = (prim.BSBody.ptr == IntPtr.Zero); 781 bool mustRebuild = (prim.PhysBody.ptr == IntPtr.Zero);
782 782
783 // If there is an existing body, verify it's of an acceptable type. 783 // If there is an existing body, verify it's of an acceptable type.
784 // If not a solid object, body is a GhostObject. Otherwise a RigidBody. 784 // If not a solid object, body is a GhostObject. Otherwise a RigidBody.
785 if (!mustRebuild) 785 if (!mustRebuild)
786 { 786 {
787 CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(prim.BSBody.ptr); 787 CollisionObjectTypes bodyType = (CollisionObjectTypes)BulletSimAPI.GetBodyType2(prim.PhysBody.ptr);
788 if (prim.IsSolid && bodyType != CollisionObjectTypes.CO_RIGID_BODY 788 if (prim.IsSolid && bodyType != CollisionObjectTypes.CO_RIGID_BODY
789 || !prim.IsSolid && bodyType != CollisionObjectTypes.CO_GHOST_OBJECT) 789 || !prim.IsSolid && bodyType != CollisionObjectTypes.CO_GHOST_OBJECT)
790 { 790 {
@@ -796,7 +796,7 @@ public sealed class BSShapeCollection : IDisposable
796 if (mustRebuild || forceRebuild) 796 if (mustRebuild || forceRebuild)
797 { 797 {
798 // Free any old body 798 // Free any old body
799 DereferenceBody(prim.BSBody, true, bodyCallback); 799 DereferenceBody(prim.PhysBody, true, bodyCallback);
800 800
801 BulletBody aBody; 801 BulletBody aBody;
802 IntPtr bodyPtr = IntPtr.Zero; 802 IntPtr bodyPtr = IntPtr.Zero;
@@ -816,7 +816,7 @@ public sealed class BSShapeCollection : IDisposable
816 816
817 ReferenceBody(aBody, true); 817 ReferenceBody(aBody, true);
818 818
819 prim.BSBody = aBody; 819 prim.PhysBody = aBody;
820 820
821 ret = true; 821 ret = true;
822 } 822 }