add OSSL functions to override linksets total mass, center of mass and inertia. replacing the crude automatic estimation based on prims known to physics and density. Changed parameters are still not saved, and are lost on region crossings. only suported by UbODE. EXPERIMENTAL feature, only test it for now.. don't try to use in products.

This commit is contained in:
UbitUmarov
2017-03-31 20:55:48 +01:00
parent b033a2559e
commit 6a35a965ff
6 changed files with 530 additions and 45 deletions

View File

@@ -55,6 +55,28 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
Absolute
}
public class PhysicsInertiaData
{
public float TotalMass; // the total mass of a linkset
public Vector3 CenterOfMass; // the center of mass position relative to root part position
public Vector3 Inertia; // (Ixx, Iyy, Izz) moment of inertia relative to center of mass and principal axis in local coords
public Vector4 InertiaRotation; // if principal axis don't match local axis, the principal axis rotation
// or the upper triangle of the inertia tensor
// Ixy (= Iyx), Ixz (= Izx), Iyz (= Izy))
public PhysicsInertiaData()
{
}
public PhysicsInertiaData(PhysicsInertiaData source)
{
TotalMass = source.TotalMass;
CenterOfMass = source.CenterOfMass;
Inertia = source.Inertia;
InertiaRotation = source.InertiaRotation;
}
}
public struct CameraData
{
public Quaternion CameraRotation;
@@ -463,6 +485,20 @@ namespace OpenSim.Region.PhysicsModules.SharedBase
public virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { }
public virtual PhysicsInertiaData GetInertiaData()
{
PhysicsInertiaData data = new PhysicsInertiaData();
data.TotalMass = this.Mass;
data.CenterOfMass = CenterOfMass - Position;
data.Inertia = Vector3.Zero;
data.InertiaRotation = Vector4.Zero;
return data;
}
public virtual void SetInertiaData(PhysicsInertiaData inertia)
{
}
// Warning in a parent part it returns itself, not null
public virtual PhysicsActor ParentActor { get { return this; } }