diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | 12 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsActor.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Manager/PhysicsScene.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 49 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 128 | ||||
-rw-r--r-- | OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 17 |
9 files changed, 242 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index c7ccef3..2b4bbc4 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | |||
@@ -189,6 +189,11 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
189 | _heightMap = heightMap; | 189 | _heightMap = heightMap; |
190 | } | 190 | } |
191 | 191 | ||
192 | public override void SetWaterLevel(float baseheight) | ||
193 | { | ||
194 | |||
195 | } | ||
196 | |||
192 | public override void DeleteTerrain() | 197 | public override void DeleteTerrain() |
193 | { | 198 | { |
194 | } | 199 | } |
@@ -243,6 +248,12 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin | |||
243 | set { return; } | 248 | set { return; } |
244 | } | 249 | } |
245 | 250 | ||
251 | public override float Buoyancy | ||
252 | { | ||
253 | get { return 0f; } | ||
254 | set { return; } | ||
255 | } | ||
256 | |||
246 | public override bool IsPhysical | 257 | public override bool IsPhysical |
247 | { | 258 | { |
248 | get { return false; } | 259 | get { return false; } |
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs index 12e2ea2..feb9ca1 100644 --- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs +++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs | |||
@@ -412,6 +412,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
412 | { | 412 | { |
413 | 413 | ||
414 | } | 414 | } |
415 | |||
416 | public override void SetWaterLevel(float baseheight) | ||
417 | { | ||
418 | |||
419 | } | ||
420 | |||
415 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) | 421 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) |
416 | { | 422 | { |
417 | PhysicsVector pos = new PhysicsVector(); | 423 | PhysicsVector pos = new PhysicsVector(); |
@@ -918,6 +924,12 @@ namespace OpenSim.Region.Physics.BulletXPlugin | |||
918 | set { return; } | 924 | set { return; } |
919 | } | 925 | } |
920 | 926 | ||
927 | public override float Buoyancy | ||
928 | { | ||
929 | get { return 0f; } | ||
930 | set { return; } | ||
931 | } | ||
932 | |||
921 | public virtual void SetAcceleration(PhysicsVector accel) | 933 | public virtual void SetAcceleration(PhysicsVector accel) |
922 | { | 934 | { |
923 | lock (BulletXScene.BulletXLock) | 935 | lock (BulletXScene.BulletXLock) |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index e31a08d..82b7450 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs | |||
@@ -208,6 +208,8 @@ namespace OpenSim.Region.Physics.Manager | |||
208 | 208 | ||
209 | public abstract bool Kinematic { get; set; } | 209 | public abstract bool Kinematic { get; set; } |
210 | 210 | ||
211 | public abstract float Buoyancy { get; set; } | ||
212 | |||
211 | public abstract void AddForce(PhysicsVector force); | 213 | public abstract void AddForce(PhysicsVector force); |
212 | 214 | ||
213 | public abstract void SetMomentum(PhysicsVector momentum); | 215 | public abstract void SetMomentum(PhysicsVector momentum); |
@@ -249,6 +251,10 @@ namespace OpenSim.Region.Physics.Manager | |||
249 | set { return; } | 251 | set { return; } |
250 | } | 252 | } |
251 | 253 | ||
254 | public override float Buoyancy { | ||
255 | get { return 0f; } | ||
256 | set { return; } | ||
257 | } | ||
252 | 258 | ||
253 | public override bool CollidingGround | 259 | public override bool CollidingGround |
254 | { | 260 | { |
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs index 996aed6..a51b2df 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs | |||
@@ -79,6 +79,8 @@ namespace OpenSim.Region.Physics.Manager | |||
79 | 79 | ||
80 | public abstract void SetTerrain(float[] heightMap); | 80 | public abstract void SetTerrain(float[] heightMap); |
81 | 81 | ||
82 | public abstract void SetWaterLevel(float baseheight); | ||
83 | |||
82 | public abstract void DeleteTerrain(); | 84 | public abstract void DeleteTerrain(); |
83 | 85 | ||
84 | public abstract void Dispose(); | 86 | public abstract void Dispose(); |
@@ -108,6 +110,10 @@ namespace OpenSim.Region.Physics.Manager | |||
108 | public override void RemovePrim(PhysicsActor prim) | 110 | public override void RemovePrim(PhysicsActor prim) |
109 | { | 111 | { |
110 | } | 112 | } |
113 | public override void SetWaterLevel(float baseheight) | ||
114 | { | ||
115 | |||
116 | } | ||
111 | 117 | ||
112 | /* | 118 | /* |
113 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) | 119 | public override PhysicsActor AddPrim(PhysicsVector position, PhysicsVector size, Quaternion rotation) |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index b5263a6..7047ec1 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -87,6 +87,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
87 | private bool m_hackSentFly = false; | 87 | private bool m_hackSentFly = false; |
88 | public uint m_localID = 0; | 88 | public uint m_localID = 0; |
89 | 89 | ||
90 | private float m_buoyancy = 0f; | ||
91 | |||
90 | private CollisionLocker ode; | 92 | private CollisionLocker ode; |
91 | 93 | ||
92 | private string m_name = String.Empty; | 94 | private string m_name = String.Empty; |
@@ -177,6 +179,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
177 | set { return; } | 179 | set { return; } |
178 | } | 180 | } |
179 | 181 | ||
182 | public override float Buoyancy | ||
183 | { | ||
184 | get { return m_buoyancy; } | ||
185 | set { m_buoyancy = value; } | ||
186 | } | ||
180 | 187 | ||
181 | public override bool IsPhysical | 188 | public override bool IsPhysical |
182 | { | 189 | { |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index c5ffe98..5291cbf 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -55,7 +55,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
55 | private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom | 55 | private const CollisionCategories m_default_collisionFlags = (CollisionCategories.Geom |
56 | | CollisionCategories.Space | 56 | | CollisionCategories.Space |
57 | | CollisionCategories.Body | 57 | | CollisionCategories.Body |
58 | | CollisionCategories.Character); | 58 | | CollisionCategories.Character |
59 | ); | ||
59 | private bool m_taintshape = false; | 60 | private bool m_taintshape = false; |
60 | private bool m_taintPhysics = false; | 61 | private bool m_taintPhysics = false; |
61 | private bool m_collidesLand = true; | 62 | private bool m_collidesLand = true; |
@@ -106,6 +107,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
106 | public int m_roundsUnderMotionThreshold = 0; | 107 | public int m_roundsUnderMotionThreshold = 0; |
107 | private int m_crossingfailures = 0; | 108 | private int m_crossingfailures = 0; |
108 | 109 | ||
110 | public float m_buoyancy = 0f; | ||
111 | |||
109 | public bool outofBounds = false; | 112 | public bool outofBounds = false; |
110 | private float m_density = 10.000006836f; // Aluminum g/cm3; | 113 | private float m_density = 10.000006836f; // Aluminum g/cm3; |
111 | 114 | ||
@@ -704,7 +707,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
704 | if (prim_geom != (IntPtr)0) | 707 | if (prim_geom != (IntPtr)0) |
705 | { | 708 | { |
706 | if (m_taintposition != _position) | 709 | if (m_taintposition != _position) |
707 | Move(timestep); | 710 | changemove(timestep); |
708 | 711 | ||
709 | if (m_taintrot != _orientation) | 712 | if (m_taintrot != _orientation) |
710 | rotate(timestep); | 713 | rotate(timestep); |
@@ -829,7 +832,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
829 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 832 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
830 | } | 833 | } |
831 | if (m_isphysical) | 834 | if (m_isphysical) |
835 | { | ||
836 | d.BodySetLinearVel(Body, 0f, 0f, 0f); | ||
832 | enableBodySoft(); | 837 | enableBodySoft(); |
838 | } | ||
833 | 839 | ||
834 | 840 | ||
835 | } | 841 | } |
@@ -1003,7 +1009,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1003 | 1009 | ||
1004 | 1010 | ||
1005 | } | 1011 | } |
1006 | public void Move(float timestep) | 1012 | public void changemove(float timestep) |
1007 | { | 1013 | { |
1008 | 1014 | ||
1009 | 1015 | ||
@@ -1063,6 +1069,37 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1063 | m_taintposition = _position; | 1069 | m_taintposition = _position; |
1064 | } | 1070 | } |
1065 | 1071 | ||
1072 | public void Move(float timestep) | ||
1073 | { | ||
1074 | |||
1075 | if (IsPhysical && Body != (IntPtr)0 && !m_isSelected) | ||
1076 | { | ||
1077 | float m_mass = CalculateMass(); | ||
1078 | //m_log.Info(m_collisionFlags.ToString()); | ||
1079 | if (m_buoyancy != 0) | ||
1080 | { | ||
1081 | float buoyancy = 0f; | ||
1082 | if (m_buoyancy > 0) | ||
1083 | { | ||
1084 | buoyancy = ((9.8f * m_buoyancy) * m_mass); | ||
1085 | |||
1086 | //d.Vector3 l_velocity = d.BodyGetLinearVel(Body); | ||
1087 | //m_log.Info("Using Buoyancy: " + buoyancy + " G: " + (9.8f * m_buoyancy) + "mass:" + m_mass + " Pos: " + Position.ToString()); | ||
1088 | } | ||
1089 | else | ||
1090 | { | ||
1091 | buoyancy = (-1 * ((9.8f * (-1 * m_buoyancy)) * m_mass)); | ||
1092 | } | ||
1093 | d.BodyAddForce(Body, 0, 0, buoyancy); | ||
1094 | |||
1095 | } | ||
1096 | } | ||
1097 | else | ||
1098 | { | ||
1099 | return; | ||
1100 | } | ||
1101 | } | ||
1102 | |||
1066 | public void rotate(float timestep) | 1103 | public void rotate(float timestep) |
1067 | { | 1104 | { |
1068 | 1105 | ||
@@ -1676,6 +1713,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1676 | } | 1713 | } |
1677 | } | 1714 | } |
1678 | 1715 | ||
1716 | public override float Buoyancy | ||
1717 | { | ||
1718 | get { return m_buoyancy; } | ||
1719 | set { m_buoyancy = value; } | ||
1720 | } | ||
1721 | |||
1679 | public override void link(PhysicsActor obj) | 1722 | public override void link(PhysicsActor obj) |
1680 | { | 1723 | { |
1681 | m_taintparent = obj; | 1724 | m_taintparent = obj; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 16c6bb0..9f160a5 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
49 | private CollisionLocker ode; | 49 | private CollisionLocker ode; |
50 | private OdeScene _mScene; | 50 | private OdeScene _mScene; |
51 | 51 | ||
52 | |||
52 | public OdePlugin() | 53 | public OdePlugin() |
53 | { | 54 | { |
54 | ode = new CollisionLocker(); | 55 | ode = new CollisionLocker(); |
@@ -98,16 +99,26 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
98 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 99 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
99 | 100 | ||
100 | CollisionLocker ode; | 101 | CollisionLocker ode; |
101 | 102 | ||
103 | protected Random fluidRandomizer = new Random(System.Environment.TickCount); | ||
104 | |||
102 | private const uint m_regionWidth = Constants.RegionSize; | 105 | private const uint m_regionWidth = Constants.RegionSize; |
103 | private const uint m_regionHeight = Constants.RegionSize; | 106 | private const uint m_regionHeight = Constants.RegionSize; |
104 | 107 | ||
105 | private static float ODE_STEPSIZE = 0.020f; | 108 | private static float ODE_STEPSIZE = 0.020f; |
106 | private static float metersInSpace = 29.9f; | 109 | private static float metersInSpace = 29.9f; |
107 | 110 | ||
111 | private float waterlevel = 0f; | ||
112 | private int framecount = 0; | ||
108 | private IntPtr contactgroup; | 113 | private IntPtr contactgroup; |
109 | private IntPtr LandGeom = (IntPtr) 0; | 114 | private IntPtr LandGeom = (IntPtr) 0; |
115 | |||
116 | private IntPtr WaterGeom = (IntPtr)0; | ||
117 | |||
110 | private float[] _heightmap; | 118 | private float[] _heightmap; |
119 | |||
120 | private float[] _watermap; | ||
121 | |||
111 | private float[] _origheightmap; | 122 | private float[] _origheightmap; |
112 | 123 | ||
113 | private d.NearCallback nearCallback; | 124 | private d.NearCallback nearCallback; |
@@ -120,13 +131,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
120 | public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); | 131 | public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); |
121 | public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); | 132 | public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>(); |
122 | private d.ContactGeom[] contacts = new d.ContactGeom[80]; | 133 | private d.ContactGeom[] contacts = new d.ContactGeom[80]; |
134 | |||
123 | private d.Contact contact; | 135 | private d.Contact contact; |
124 | private d.Contact TerrainContact; | 136 | private d.Contact TerrainContact; |
125 | private d.Contact AvatarMovementprimContact; | 137 | private d.Contact AvatarMovementprimContact; |
126 | private d.Contact AvatarMovementTerrainContact; | 138 | private d.Contact AvatarMovementTerrainContact; |
139 | private d.Contact WaterContact; | ||
127 | 140 | ||
128 | |||
129 | 141 | ||
142 | private int m_randomizeWater = 200; | ||
130 | private int m_physicsiterations = 10; | 143 | private int m_physicsiterations = 10; |
131 | private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag | 144 | private float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag |
132 | private PhysicsActor PANull = new NullPhysicsActor(); | 145 | private PhysicsActor PANull = new NullPhysicsActor(); |
@@ -176,6 +189,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
176 | TerrainContact.surface.bounce = 0.1f; | 189 | TerrainContact.surface.bounce = 0.1f; |
177 | TerrainContact.surface.soft_erp = 0.1025f; | 190 | TerrainContact.surface.soft_erp = 0.1025f; |
178 | 191 | ||
192 | WaterContact.surface.mode |= (d.ContactFlags.SoftERP | d.ContactFlags.SoftCFM); | ||
193 | WaterContact.surface.mu = 0f; // No friction | ||
194 | WaterContact.surface.bounce = 0.0f; // No bounce | ||
195 | WaterContact.surface.soft_cfm = 0.01f; | ||
196 | WaterContact.surface.soft_erp = 0.010f; | ||
197 | |||
179 | // Prim contact friction and bounce | 198 | // Prim contact friction and bounce |
180 | // THis is the *non* moving version of friction and bounce | 199 | // THis is the *non* moving version of friction and bounce |
181 | // Use this when an avatar comes in contact with a prim | 200 | // Use this when an avatar comes in contact with a prim |
@@ -187,8 +206,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
187 | // Use this when an avatar is in contact with the terrain and moving. | 206 | // Use this when an avatar is in contact with the terrain and moving. |
188 | AvatarMovementTerrainContact.surface.mode |= d.ContactFlags.SoftERP; | 207 | AvatarMovementTerrainContact.surface.mode |= d.ContactFlags.SoftERP; |
189 | AvatarMovementTerrainContact.surface.mu = 75.0f; | 208 | AvatarMovementTerrainContact.surface.mu = 75.0f; |
190 | AvatarMovementTerrainContact.surface.bounce = 0.1f; | 209 | AvatarMovementTerrainContact.surface.bounce = 0.05f; |
191 | AvatarMovementTerrainContact.surface.soft_erp = 0.1025f; | 210 | AvatarMovementTerrainContact.surface.soft_erp = 0.05025f; |
192 | 211 | ||
193 | lock (OdeLock) | 212 | lock (OdeLock) |
194 | { | 213 | { |
@@ -216,7 +235,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
216 | 235 | ||
217 | // zero out a heightmap array float array (single dimention [flattened])) | 236 | // zero out a heightmap array float array (single dimention [flattened])) |
218 | _heightmap = new float[514*514]; | 237 | _heightmap = new float[514*514]; |
219 | 238 | _watermap = new float[258 * 258]; | |
220 | 239 | ||
221 | // Zero out the prim spaces array (we split our space into smaller spaces so | 240 | // Zero out the prim spaces array (we split our space into smaller spaces so |
222 | // we can hit test less. | 241 | // we can hit test less. |
@@ -571,12 +590,36 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
571 | joint = d.JointCreateContact(world, contactgroup, ref TerrainContact); | 590 | joint = d.JointCreateContact(world, contactgroup, ref TerrainContact); |
572 | } | 591 | } |
573 | } | 592 | } |
593 | else if (name1 == "Water" || name2 == "Water") | ||
594 | { | ||
595 | if ((p2.PhysicsActorType == (int)ActorTypes.Prim)) | ||
596 | { | ||
597 | |||
598 | } | ||
599 | else | ||
600 | { | ||
601 | |||
602 | } | ||
603 | WaterContact.surface.soft_cfm = 0.0000f; | ||
604 | WaterContact.surface.soft_erp = 0.00000f; | ||
605 | if (contacts[i].depth > 0.1f) | ||
606 | { | ||
607 | contacts[i].depth *= 52; | ||
608 | //contacts[i].normal = new d.Vector3(0, 0, 1); | ||
609 | //contacts[i].pos = new d.Vector3(0, 0, contacts[i].pos.Z - 5f); | ||
610 | } | ||
611 | WaterContact.geom = contacts[i]; | ||
612 | |||
613 | joint = d.JointCreateContact(world, contactgroup, ref WaterContact); | ||
614 | |||
615 | //m_log.Info("[PHYSICS]: Prim Water Contact" + contacts[i].depth); | ||
616 | } | ||
574 | else | 617 | else |
575 | { | 618 | { |
576 | // we're colliding with prim or avatar | 619 | // we're colliding with prim or avatar |
577 | 620 | ||
578 | // check if we're moving | 621 | // check if we're moving |
579 | if ((p2.PhysicsActorType == (int) ActorTypes.Agent) && | 622 | if ((p2.PhysicsActorType == (int)ActorTypes.Agent) && |
580 | (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) | 623 | (Math.Abs(p2.Velocity.X) > 0.01f || Math.Abs(p2.Velocity.Y) > 0.01f)) |
581 | { | 624 | { |
582 | // Use the Movement prim contact | 625 | // Use the Movement prim contact |
@@ -1279,6 +1322,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1279 | /// <returns></returns> | 1322 | /// <returns></returns> |
1280 | public override float Simulate(float timeStep) | 1323 | public override float Simulate(float timeStep) |
1281 | { | 1324 | { |
1325 | if (framecount >= int.MaxValue) | ||
1326 | framecount = 0; | ||
1327 | |||
1328 | framecount++; | ||
1329 | |||
1282 | float fps = 0; | 1330 | float fps = 0; |
1283 | //m_log.Info(timeStep.ToString()); | 1331 | //m_log.Info(timeStep.ToString()); |
1284 | step_time += timeStep; | 1332 | step_time += timeStep; |
@@ -1369,11 +1417,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1369 | foreach (OdePrim prim in _activeprims) | 1417 | foreach (OdePrim prim in _activeprims) |
1370 | { | 1418 | { |
1371 | prim.m_collisionscore = 0; | 1419 | prim.m_collisionscore = 0; |
1420 | prim.Move(timeStep); | ||
1372 | } | 1421 | } |
1373 | } | 1422 | } |
1374 | 1423 | ||
1375 | 1424 | //if ((framecount % m_randomizeWater) == 0) | |
1376 | 1425 | // randomizeWater(waterlevel); | |
1377 | 1426 | ||
1378 | 1427 | ||
1379 | collision_optimized(timeStep); | 1428 | collision_optimized(timeStep); |
@@ -1772,6 +1821,69 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1772 | { | 1821 | { |
1773 | } | 1822 | } |
1774 | 1823 | ||
1824 | public override void SetWaterLevel(float baseheight) | ||
1825 | { | ||
1826 | waterlevel = baseheight; | ||
1827 | randomizeWater(waterlevel); | ||
1828 | } | ||
1829 | |||
1830 | public void randomizeWater(float baseheight) | ||
1831 | { | ||
1832 | const uint heightmapWidth = m_regionWidth + 2; | ||
1833 | const uint heightmapHeight = m_regionHeight + 2; | ||
1834 | const uint heightmapWidthSamples = m_regionWidth + 2; | ||
1835 | const uint heightmapHeightSamples = m_regionHeight + 2; | ||
1836 | const float scale = 1.0f; | ||
1837 | const float offset = 0.0f; | ||
1838 | const float thickness = 2.9f; | ||
1839 | const int wrap = 0; | ||
1840 | |||
1841 | for (int i = 0; i < (258 * 258); i++) | ||
1842 | { | ||
1843 | _watermap[i] = (baseheight-0.1f) + ((float)fluidRandomizer.Next(1,9) / 10f); | ||
1844 | // m_log.Info((baseheight - 0.1f) + ((float)fluidRandomizer.Next(1, 9) / 10f)); | ||
1845 | } | ||
1846 | |||
1847 | |||
1848 | lock (OdeLock) | ||
1849 | { | ||
1850 | if (!(WaterGeom == (IntPtr)0)) | ||
1851 | { | ||
1852 | d.SpaceRemove(space, WaterGeom); | ||
1853 | } | ||
1854 | IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); | ||
1855 | d.GeomHeightfieldDataBuildSingle(HeightmapData, _watermap, 0, heightmapWidth, heightmapHeight, | ||
1856 | (int)heightmapWidthSamples, (int)heightmapHeightSamples, scale, | ||
1857 | offset, thickness, wrap); | ||
1858 | d.GeomHeightfieldDataSetBounds(HeightmapData, m_regionWidth, m_regionHeight); | ||
1859 | WaterGeom = d.CreateHeightfield(space, HeightmapData, 1); | ||
1860 | if (WaterGeom != (IntPtr)0) | ||
1861 | { | ||
1862 | d.GeomSetCategoryBits(WaterGeom, (int)(CollisionCategories.Water)); | ||
1863 | d.GeomSetCollideBits(WaterGeom, (int)(CollisionCategories.Space)); | ||
1864 | |||
1865 | } | ||
1866 | geom_name_map[WaterGeom] = "Water"; | ||
1867 | |||
1868 | d.Matrix3 R = new d.Matrix3(); | ||
1869 | |||
1870 | Quaternion q1 = Quaternion.FromAngleAxis(1.5707f, new Vector3(1, 0, 0)); | ||
1871 | Quaternion q2 = Quaternion.FromAngleAxis(1.5707f, new Vector3(0, 1, 0)); | ||
1872 | //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); | ||
1873 | |||
1874 | q1 = q1 * q2; | ||
1875 | //q1 = q1 * q3; | ||
1876 | Vector3 v3 = new Vector3(); | ||
1877 | float angle = 0; | ||
1878 | q1.ToAngleAxis(ref angle, ref v3); | ||
1879 | |||
1880 | d.RFromAxisAndAngle(out R, v3.x, v3.y, v3.z, angle); | ||
1881 | d.GeomSetRotation(WaterGeom, ref R); | ||
1882 | d.GeomSetPosition(WaterGeom, 128, 128, 0); | ||
1883 | } | ||
1884 | |||
1885 | } | ||
1886 | |||
1775 | public override void Dispose() | 1887 | public override void Dispose() |
1776 | { | 1888 | { |
1777 | lock (OdeLock) | 1889 | lock (OdeLock) |
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs index ac63a12..dd2c0dd 100644 --- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs +++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs | |||
@@ -89,6 +89,11 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
89 | return act; | 89 | return act; |
90 | } | 90 | } |
91 | 91 | ||
92 | public override void SetWaterLevel(float baseheight) | ||
93 | { | ||
94 | |||
95 | } | ||
96 | |||
92 | public override void RemovePrim(PhysicsActor prim) | 97 | public override void RemovePrim(PhysicsActor prim) |
93 | { | 98 | { |
94 | POSPrim p = (POSPrim) prim; | 99 | POSPrim p = (POSPrim) prim; |
@@ -372,6 +377,12 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
372 | set { return; } | 377 | set { return; } |
373 | } | 378 | } |
374 | 379 | ||
380 | public override float Buoyancy | ||
381 | { | ||
382 | get { return 0f; } | ||
383 | set { return; } | ||
384 | } | ||
385 | |||
375 | public override bool IsPhysical | 386 | public override bool IsPhysical |
376 | { | 387 | { |
377 | get { return false; } | 388 | get { return false; } |
@@ -605,6 +616,12 @@ namespace OpenSim.Region.Physics.POSPlugin | |||
605 | set { return; } | 616 | set { return; } |
606 | } | 617 | } |
607 | 618 | ||
619 | public override float Buoyancy | ||
620 | { | ||
621 | get { return 0f; } | ||
622 | set { return; } | ||
623 | } | ||
624 | |||
608 | public override PhysicsVector Velocity | 625 | public override PhysicsVector Velocity |
609 | { | 626 | { |
610 | get { return _velocity; } | 627 | get { return _velocity; } |
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs index 0c42260..b03da31 100644 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | |||
@@ -93,6 +93,11 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
93 | 93 | ||
94 | } | 94 | } |
95 | 95 | ||
96 | public override void SetWaterLevel(float baseheight) | ||
97 | { | ||
98 | |||
99 | } | ||
100 | |||
96 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) | 101 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) |
97 | { | 102 | { |
98 | Vec3 pos = new Vec3(); | 103 | Vec3 pos = new Vec3(); |
@@ -242,6 +247,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
242 | set { return; } | 247 | set { return; } |
243 | } | 248 | } |
244 | 249 | ||
250 | public override float Buoyancy | ||
251 | { | ||
252 | get { return 0f; } | ||
253 | set { return; } | ||
254 | } | ||
255 | |||
245 | public override bool IsPhysical | 256 | public override bool IsPhysical |
246 | { | 257 | { |
247 | get { return false; } | 258 | get { return false; } |
@@ -467,6 +478,12 @@ namespace OpenSim.Region.Physics.PhysXPlugin | |||
467 | set { return; } | 478 | set { return; } |
468 | } | 479 | } |
469 | 480 | ||
481 | public override float Buoyancy | ||
482 | { | ||
483 | get { return 0f; } | ||
484 | set { return; } | ||
485 | } | ||
486 | |||
470 | public override bool ThrottleUpdates | 487 | public override bool ThrottleUpdates |
471 | { | 488 | { |
472 | get { return false; } | 489 | get { return false; } |