diff options
Diffstat (limited to 'OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs')
-rw-r--r-- | OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs index 33f0337..ad9b28f 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsActor.cs | |||
@@ -55,6 +55,28 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
55 | Absolute | 55 | Absolute |
56 | } | 56 | } |
57 | 57 | ||
58 | public class PhysicsInertiaData | ||
59 | { | ||
60 | public float TotalMass; // the total mass of a linkset | ||
61 | public Vector3 CenterOfMass; // the center of mass position relative to root part position | ||
62 | public Vector3 Inertia; // (Ixx, Iyy, Izz) moment of inertia relative to center of mass and principal axis in local coords | ||
63 | public Vector4 InertiaRotation; // if principal axis don't match local axis, the principal axis rotation | ||
64 | // or the upper triangle of the inertia tensor | ||
65 | // Ixy (= Iyx), Ixz (= Izx), Iyz (= Izy)) | ||
66 | |||
67 | public PhysicsInertiaData() | ||
68 | { | ||
69 | } | ||
70 | |||
71 | public PhysicsInertiaData(PhysicsInertiaData source) | ||
72 | { | ||
73 | TotalMass = source.TotalMass; | ||
74 | CenterOfMass = source.CenterOfMass; | ||
75 | Inertia = source.Inertia; | ||
76 | InertiaRotation = source.InertiaRotation; | ||
77 | } | ||
78 | } | ||
79 | |||
58 | public struct CameraData | 80 | public struct CameraData |
59 | { | 81 | { |
60 | public Quaternion CameraRotation; | 82 | public Quaternion CameraRotation; |
@@ -463,6 +485,20 @@ namespace OpenSim.Region.PhysicsModules.SharedBase | |||
463 | 485 | ||
464 | public virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { } | 486 | public virtual void AddCollisionEvent(uint CollidedWith, ContactPoint contact) { } |
465 | 487 | ||
488 | public virtual PhysicsInertiaData GetInertiaData() | ||
489 | { | ||
490 | PhysicsInertiaData data = new PhysicsInertiaData(); | ||
491 | data.TotalMass = this.Mass; | ||
492 | data.CenterOfMass = CenterOfMass - Position; | ||
493 | data.Inertia = Vector3.Zero; | ||
494 | data.InertiaRotation = Vector4.Zero; | ||
495 | return data; | ||
496 | } | ||
497 | |||
498 | public virtual void SetInertiaData(PhysicsInertiaData inertia) | ||
499 | { | ||
500 | } | ||
501 | |||
466 | // Warning in a parent part it returns itself, not null | 502 | // Warning in a parent part it returns itself, not null |
467 | public virtual PhysicsActor ParentActor { get { return this; } } | 503 | public virtual PhysicsActor ParentActor { get { return this; } } |
468 | 504 | ||