aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs12
1 files changed, 8 insertions, 4 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 159f79f..0d13096 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -422,20 +422,24 @@ public sealed class BSPrim : BSPhysObject
422 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 422 BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
423 } 423 }
424 424
425 float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
426 BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav));
427
428 Inertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass); 425 Inertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass);
429 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, Inertia); 426 BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, Inertia);
430 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr); 427 BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr);
428
431 // center of mass is at the zero of the object 429 // center of mass is at the zero of the object
432 // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation); 430 // DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation);
433 DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2}", LocalID, physMass, Inertia); 431 DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2},inWorld={3}", LocalID, physMass, Inertia, inWorld);
434 432
435 if (inWorld) 433 if (inWorld)
436 { 434 {
437 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr); 435 BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
438 } 436 }
437
438 // Must set gravity after it has been added to the world because, for unknown reasons,
439 // adding the object resets the object's gravity to world gravity
440 OMV.Vector3 grav = PhysicsScene.DefaultGravity * (1f - Buoyancy);
441 BulletSimAPI.SetGravity2(PhysBody.ptr, grav);
442
439 } 443 }
440 } 444 }
441 } 445 }