aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs19
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs52
2 files changed, 65 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
index a7dda7a..3c952ae 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
@@ -137,6 +137,7 @@ namespace OpenSim.Region.Physics.OdePlugin
137 float m_amdampY; 137 float m_amdampY;
138 float m_amdampZ; 138 float m_amdampZ;
139 139
140 float m_gravmod;
140 141
141 public float FrictionFactor 142 public float FrictionFactor
142 { 143 {
@@ -146,6 +147,14 @@ namespace OpenSim.Region.Physics.OdePlugin
146 } 147 }
147 } 148 }
148 149
150 public float GravMod
151 {
152 set
153 {
154 m_gravmod = value;
155 }
156 }
157
149 158
150 public ODEDynamics(OdePrim rootp) 159 public ODEDynamics(OdePrim rootp)
151 { 160 {
@@ -153,6 +162,7 @@ namespace OpenSim.Region.Physics.OdePlugin
153 _pParentScene = rootPrim._parent_scene; 162 _pParentScene = rootPrim._parent_scene;
154 m_timestep = _pParentScene.ODE_STEPSIZE; 163 m_timestep = _pParentScene.ODE_STEPSIZE;
155 m_invtimestep = 1.0f / m_timestep; 164 m_invtimestep = 1.0f / m_timestep;
165 m_gravmod = rootPrim.GravModifier;
156 } 166 }
157 167
158 public void DoSetVehicle(VehicleData vd) 168 public void DoSetVehicle(VehicleData vd)
@@ -816,7 +826,7 @@ namespace OpenSim.Region.Physics.OdePlugin
816 m_lmEfect = 0; 826 m_lmEfect = 0;
817 m_ffactor = 1f; 827 m_ffactor = 1f;
818 } 828 }
819 829
820 // hover 830 // hover
821 if (m_VhoverTimescale < 300 && rootPrim.prim_geom != IntPtr.Zero) 831 if (m_VhoverTimescale < 300 && rootPrim.prim_geom != IntPtr.Zero)
822 { 832 {
@@ -862,7 +872,7 @@ namespace OpenSim.Region.Physics.OdePlugin
862 force.Z += perr; 872 force.Z += perr;
863 ldampZ *= -curVel.Z; 873 ldampZ *= -curVel.Z;
864 874
865 force.Z += _pParentScene.gravityz * (1f - m_VehicleBuoyancy); 875 force.Z += _pParentScene.gravityz * m_gravmod * (1f - m_VehicleBuoyancy);
866 } 876 }
867 else // no buoyancy 877 else // no buoyancy
868 force.Z += _pParentScene.gravityz; 878 force.Z += _pParentScene.gravityz;
@@ -870,7 +880,7 @@ namespace OpenSim.Region.Physics.OdePlugin
870 else 880 else
871 { 881 {
872 // default gravity and Buoyancy 882 // default gravity and Buoyancy
873 force.Z += _pParentScene.gravityz * (1f - m_VehicleBuoyancy); 883 force.Z += _pParentScene.gravityz * m_gravmod * (1f - m_VehicleBuoyancy);
874 } 884 }
875 885
876 // linear deflection 886 // linear deflection
@@ -1063,8 +1073,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1063 torque.Y -= curLocalAngVel.Y * m_amdampY; 1073 torque.Y -= curLocalAngVel.Y * m_amdampY;
1064 torque.Z -= curLocalAngVel.Z * m_amdampZ; 1074 torque.Z -= curLocalAngVel.Z * m_amdampZ;
1065 } 1075 }
1066 1076
1067
1068 1077
1069 if (force.X != 0 || force.Y != 0 || force.Z != 0) 1078 if (force.X != 0 || force.Y != 0 || force.Z != 0)
1070 { 1079 {
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index 7cabddd..e3f88c6 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -115,6 +115,7 @@ namespace OpenSim.Region.Physics.OdePlugin
115 115
116 private int body_autodisable_frames; 116 private int body_autodisable_frames;
117 public int bodydisablecontrol; 117 public int bodydisablecontrol;
118 private float m_gravmod = 1.0f;
118 119
119 120
120 // Default we're a Geometry 121 // Default we're a Geometry
@@ -914,6 +915,55 @@ namespace OpenSim.Region.Physics.OdePlugin
914 bounce = _parent_scene.m_materialContactsData[pMaterial].bounce; 915 bounce = _parent_scene.m_materialContactsData[pMaterial].bounce;
915 } 916 }
916 917
918 public override float Density
919 {
920 get
921 {
922 return m_density * 100f;
923 }
924 set
925 {
926 m_density = value / 100f;
927 // for not prim mass is not updated since this implies full rebuild of body inertia TODO
928 }
929 }
930 public override float GravModifier
931 {
932 get
933 {
934 return m_gravmod;
935 }
936 set
937 {
938 m_gravmod = value;
939 if (m_vehicle != null)
940 m_vehicle.GravMod = m_gravmod;
941 }
942 }
943 public override float Friction
944 {
945 get
946 {
947 return mu;
948 }
949 set
950 {
951 mu = value;
952 }
953 }
954
955 public override float Restitution
956 {
957 get
958 {
959 return bounce;
960 }
961 set
962 {
963 bounce = value;
964 }
965 }
966
917 public void setPrimForRemoval() 967 public void setPrimForRemoval()
918 { 968 {
919 AddChange(changes.Remove, null); 969 AddChange(changes.Remove, null);
@@ -3336,7 +3386,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3336 } 3386 }
3337 else 3387 else
3338 { 3388 {
3339 float b = (1.0f - m_buoyancy); 3389 float b = (1.0f - m_buoyancy) * m_gravmod;
3340 fx = _parent_scene.gravityx * b; 3390 fx = _parent_scene.gravityx * b;
3341 fy = _parent_scene.gravityy * b; 3391 fy = _parent_scene.gravityy * b;
3342 fz = _parent_scene.gravityz * b; 3392 fz = _parent_scene.gravityz * b;