BulletSim: make llBuoyancy work. For some reason, Bullet resets an
object's individual gravity to the world gravity when the object is added to the physical world.0.7.5-pf-bulletsim
parent
5f71ee57c4
commit
d1ede1df3a
|
@ -573,6 +573,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
BulletSimAPI.SetMassProps2(Prim.PhysBody.ptr, m_vehicleMass, localInertia);
|
||||
BulletSimAPI.UpdateInertiaTensor2(Prim.PhysBody.ptr);
|
||||
|
||||
Vector3 grav = PhysicsScene.DefaultGravity * (1f - Prim.Buoyancy);
|
||||
BulletSimAPI.SetGravity2(Prim.PhysBody.ptr, grav);
|
||||
|
||||
VDetailLog("{0},BSDynamics.Refresh,mass={1},frict={2},inert={3},aDamp={4}",
|
||||
Prim.LocalID, m_vehicleMass, friction, localInertia, angularDamping);
|
||||
}
|
||||
|
|
|
@ -422,20 +422,24 @@ public sealed class BSPrim : BSPhysObject
|
|||
BulletSimAPI.RemoveObjectFromWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
|
||||
}
|
||||
|
||||
float grav = PhysicsScene.Params.gravity * (1f - _buoyancy);
|
||||
BulletSimAPI.SetGravity2(PhysBody.ptr, new OMV.Vector3(0f, 0f, grav));
|
||||
|
||||
Inertia = BulletSimAPI.CalculateLocalInertia2(PhysShape.ptr, physMass);
|
||||
BulletSimAPI.SetMassProps2(PhysBody.ptr, physMass, Inertia);
|
||||
BulletSimAPI.UpdateInertiaTensor2(PhysBody.ptr);
|
||||
|
||||
// center of mass is at the zero of the object
|
||||
// DEBUG DEBUG BulletSimAPI.SetCenterOfMassByPosRot2(PhysBody.ptr, ForcePosition, ForceOrientation);
|
||||
DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2}", LocalID, physMass, Inertia);
|
||||
DetailLog("{0},BSPrim.UpdateMassProperties,mass={1},localInertia={2},inWorld={3}", LocalID, physMass, Inertia, inWorld);
|
||||
|
||||
if (inWorld)
|
||||
{
|
||||
BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, PhysBody.ptr);
|
||||
}
|
||||
|
||||
// Must set gravity after it has been added to the world because, for unknown reasons,
|
||||
// adding the object resets the object's gravity to world gravity
|
||||
OMV.Vector3 grav = PhysicsScene.DefaultGravity * (1f - Buoyancy);
|
||||
BulletSimAPI.SetGravity2(PhysBody.ptr, grav);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ Incorporate inter-relationship of angular corrections. For instance, angularDefl
|
|||
|
||||
BULLETSIM TODO LIST:
|
||||
=================================================
|
||||
In SL, perfect spheres don't seem to have rolling friction. Add special case.
|
||||
Avatar density is WAY off. Compare and calibrate with what's in SL.
|
||||
Revisit CollisionMargin. Builders notice the 0.04 spacing between prims.
|
||||
Duplicating a physical prim causes old prim to jump away
|
||||
|
@ -146,6 +145,8 @@ Is there are more efficient method of implementing pre and post step actions?
|
|||
See http://www.codeproject.com/Articles/29922/Weak-Events-in-C
|
||||
|
||||
Physics Arena central pyramid: why is one side permiable?
|
||||
|
||||
In SL, perfect spheres don't seem to have rolling friction. Add special case.
|
||||
Enforce physical parameter min/max:
|
||||
Gravity: [-1, 28]
|
||||
Friction: [0, 255]
|
||||
|
|
Loading…
Reference in New Issue