diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 1d94142..33ae5a5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs | |||
@@ -44,6 +44,42 @@ public sealed class BSLinksetCompound : BSLinkset | |||
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||
47 | // ================================================================ | ||
48 | // Changing the physical property of the linkset only needs to change the root | ||
49 | public override void SetPhysicalFriction(float friction) | ||
50 | { | ||
51 | if (LinksetRoot.PhysBody.HasPhysicalBody) | ||
52 | m_physicsScene.PE.SetFriction(LinksetRoot.PhysBody, friction); | ||
53 | } | ||
54 | public override void SetPhysicalRestitution(float restitution) | ||
55 | { | ||
56 | if (LinksetRoot.PhysBody.HasPhysicalBody) | ||
57 | m_physicsScene.PE.SetRestitution(LinksetRoot.PhysBody, restitution); | ||
58 | } | ||
59 | public override void SetPhysicalGravity(OMV.Vector3 gravity) | ||
60 | { | ||
61 | if (LinksetRoot.PhysBody.HasPhysicalBody) | ||
62 | m_physicsScene.PE.SetGravity(LinksetRoot.PhysBody, gravity); | ||
63 | } | ||
64 | public override void ComputeLocalInertia(OMV.Vector3 inertiaFactor) | ||
65 | { | ||
66 | OMV.Vector3 inertia = m_physicsScene.PE.CalculateLocalInertia(LinksetRoot.PhysShape.physShapeInfo, LinksetRoot.Mass); | ||
67 | LinksetRoot.Inertia = inertia * inertiaFactor; | ||
68 | m_physicsScene.PE.SetMassProps(LinksetRoot.PhysBody, LinksetRoot.Mass, LinksetRoot.Inertia); | ||
69 | m_physicsScene.PE.UpdateInertiaTensor(LinksetRoot.PhysBody); | ||
70 | } | ||
71 | public override void SetPhysicalCollisionFlags(CollisionFlags collFlags) | ||
72 | { | ||
73 | if (LinksetRoot.PhysBody.HasPhysicalBody) | ||
74 | m_physicsScene.PE.SetCollisionFlags(LinksetRoot.PhysBody, collFlags); | ||
75 | } | ||
76 | public override void RemoveFromPhysicalCollisionFlags(CollisionFlags collFlags) | ||
77 | { | ||
78 | if (LinksetRoot.PhysBody.HasPhysicalBody) | ||
79 | m_physicsScene.PE.RemoveFromCollisionFlags(LinksetRoot.PhysBody, collFlags); | ||
80 | } | ||
81 | // ================================================================ | ||
82 | |||
47 | // When physical properties are changed the linkset needs to recalculate | 83 | // When physical properties are changed the linkset needs to recalculate |
48 | // its internal properties. | 84 | // its internal properties. |
49 | public override void Refresh(BSPrimLinkable requestor) | 85 | public override void Refresh(BSPrimLinkable requestor) |
@@ -59,6 +95,7 @@ public sealed class BSLinksetCompound : BSLinkset | |||
59 | { | 95 | { |
60 | DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}", | 96 | DetailLog("{0},BSLinksetCompound.ScheduleRebuild,,rebuilding={1},hasChildren={2},actuallyScheduling={3}", |
61 | requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren)); | 97 | requestor.LocalID, Rebuilding, HasAnyChildren, (!Rebuilding && HasAnyChildren)); |
98 | |||
62 | // When rebuilding, it is possible to set properties that would normally require a rebuild. | 99 | // When rebuilding, it is possible to set properties that would normally require a rebuild. |
63 | // If already rebuilding, don't request another rebuild. | 100 | // If already rebuilding, don't request another rebuild. |
64 | // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding. | 101 | // If a linkset with just a root prim (simple non-linked prim) don't bother rebuilding. |