diff options
author | Robert Adams | 2012-09-27 09:31:33 -0700 |
---|---|---|
committer | Robert Adams | 2012-09-27 22:02:03 -0700 |
commit | 7b65985047bdf0789fe3eccf8f515279f362abf1 (patch) | |
tree | e29509c2e8fc094d50dda62d841dbaa9cf91cfeb /OpenSim/Region/Physics | |
parent | BulletSim: remove the unused body management code from BSPrim. There is no go... (diff) | |
download | opensim-SC-7b65985047bdf0789fe3eccf8f515279f362abf1.zip opensim-SC-7b65985047bdf0789fe3eccf8f515279f362abf1.tar.gz opensim-SC-7b65985047bdf0789fe3eccf8f515279f362abf1.tar.bz2 opensim-SC-7b65985047bdf0789fe3eccf8f515279f362abf1.tar.xz |
BulletSim: remove the trailing spaces from lines to make git happier
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 185 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 14 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | 30 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 212 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 26 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | 42 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | 4 |
10 files changed, 275 insertions, 276 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 961bcde..b88ec3c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -122,7 +122,6 @@ public class BSCharacter : BSPhysObject | |||
122 | BulletSimAPI.SetCollisionFilterMask2(BSBody.ptr, | 122 | BulletSimAPI.SetCollisionFilterMask2(BSBody.ptr, |
123 | (uint)CollisionFilterGroups.AvatarFilter, (uint)CollisionFilterGroups.AvatarMask); | 123 | (uint)CollisionFilterGroups.AvatarFilter, (uint)CollisionFilterGroups.AvatarMask); |
124 | }); | 124 | }); |
125 | |||
126 | return; | 125 | return; |
127 | } | 126 | } |
128 | 127 | ||
@@ -141,8 +140,8 @@ public class BSCharacter : BSPhysObject | |||
141 | base.RequestPhysicsterseUpdate(); | 140 | base.RequestPhysicsterseUpdate(); |
142 | } | 141 | } |
143 | // No one calls this method so I don't know what it could possibly mean | 142 | // No one calls this method so I don't know what it could possibly mean |
144 | public override bool Stopped { | 143 | public override bool Stopped { |
145 | get { return false; } | 144 | get { return false; } |
146 | } | 145 | } |
147 | public override OMV.Vector3 Size { | 146 | public override OMV.Vector3 Size { |
148 | get | 147 | get |
@@ -151,7 +150,7 @@ public class BSCharacter : BSPhysObject | |||
151 | return new OMV.Vector3(_scale.X * 2, _scale.Y * 2, _scale.Z); | 150 | return new OMV.Vector3(_scale.X * 2, _scale.Y * 2, _scale.Z); |
152 | } | 151 | } |
153 | 152 | ||
154 | set { | 153 | set { |
155 | // When an avatar's size is set, only the height is changed | 154 | // When an avatar's size is set, only the height is changed |
156 | // and that really only depends on the radius. | 155 | // and that really only depends on the radius. |
157 | _size = value; | 156 | _size = value; |
@@ -166,19 +165,19 @@ public class BSCharacter : BSPhysObject | |||
166 | BulletSimAPI.SetObjectScaleMass(PhysicsScene.WorldID, LocalID, _scale, _mass, true); | 165 | BulletSimAPI.SetObjectScaleMass(PhysicsScene.WorldID, LocalID, _scale, _mass, true); |
167 | }); | 166 | }); |
168 | 167 | ||
169 | } | 168 | } |
170 | } | 169 | } |
171 | public override PrimitiveBaseShape Shape { | 170 | public override PrimitiveBaseShape Shape { |
172 | set { _pbs = value; | 171 | set { _pbs = value; |
173 | } | 172 | } |
174 | } | 173 | } |
175 | public override bool Grabbed { | 174 | public override bool Grabbed { |
176 | set { _grabbed = value; | 175 | set { _grabbed = value; |
177 | } | 176 | } |
178 | } | 177 | } |
179 | public override bool Selected { | 178 | public override bool Selected { |
180 | set { _selected = value; | 179 | set { _selected = value; |
181 | } | 180 | } |
182 | } | 181 | } |
183 | public override void CrossingFailure() { return; } | 182 | public override void CrossingFailure() { return; } |
184 | public override void link(PhysicsActor obj) { return; } | 183 | public override void link(PhysicsActor obj) { return; } |
@@ -203,11 +202,11 @@ public class BSCharacter : BSPhysObject | |||
203 | 202 | ||
204 | public override void LockAngularMotion(OMV.Vector3 axis) { return; } | 203 | public override void LockAngularMotion(OMV.Vector3 axis) { return; } |
205 | 204 | ||
206 | public override OMV.Vector3 Position { | 205 | public override OMV.Vector3 Position { |
207 | get { | 206 | get { |
208 | // _position = BulletSimAPI.GetObjectPosition(Scene.WorldID, _localID); | 207 | // _position = BulletSimAPI.GetObjectPosition(Scene.WorldID, _localID); |
209 | return _position; | 208 | return _position; |
210 | } | 209 | } |
211 | set { | 210 | set { |
212 | _position = value; | 211 | _position = value; |
213 | PositionSanityCheck(); | 212 | PositionSanityCheck(); |
@@ -217,7 +216,7 @@ public class BSCharacter : BSPhysObject | |||
217 | DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 216 | DetailLog("{0},BSCharacter.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
218 | BulletSimAPI.SetObjectTranslation(PhysicsScene.WorldID, LocalID, _position, _orientation); | 217 | BulletSimAPI.SetObjectTranslation(PhysicsScene.WorldID, LocalID, _position, _orientation); |
219 | }); | 218 | }); |
220 | } | 219 | } |
221 | } | 220 | } |
222 | 221 | ||
223 | // Check that the current position is sane and, if not, modify the position to make it so. | 222 | // Check that the current position is sane and, if not, modify the position to make it so. |
@@ -226,7 +225,7 @@ public class BSCharacter : BSPhysObject | |||
226 | private bool PositionSanityCheck() | 225 | private bool PositionSanityCheck() |
227 | { | 226 | { |
228 | bool ret = false; | 227 | bool ret = false; |
229 | 228 | ||
230 | // If below the ground, move the avatar up | 229 | // If below the ground, move the avatar up |
231 | float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); | 230 | float terrainHeight = PhysicsScene.TerrainManager.GetTerrainHeightAtXYZ(_position); |
232 | if (Position.Z < terrainHeight) | 231 | if (Position.Z < terrainHeight) |
@@ -260,17 +259,17 @@ public class BSCharacter : BSPhysObject | |||
260 | return ret; | 259 | return ret; |
261 | } | 260 | } |
262 | 261 | ||
263 | public override float Mass { | 262 | public override float Mass { |
264 | get { | 263 | get { |
265 | return _mass; | 264 | return _mass; |
266 | } | 265 | } |
267 | } | 266 | } |
268 | 267 | ||
269 | // used when we only want this prim's mass and not the linkset thing | 268 | // used when we only want this prim's mass and not the linkset thing |
270 | public override float MassRaw { get {return _mass; } } | 269 | public override float MassRaw { get {return _mass; } } |
271 | 270 | ||
272 | public override OMV.Vector3 Force { | 271 | public override OMV.Vector3 Force { |
273 | get { return _force; } | 272 | get { return _force; } |
274 | set { | 273 | set { |
275 | _force = value; | 274 | _force = value; |
276 | // m_log.DebugFormat("{0}: Force = {1}", LogHeader, _force); | 275 | // m_log.DebugFormat("{0}: Force = {1}", LogHeader, _force); |
@@ -279,12 +278,12 @@ public class BSCharacter : BSPhysObject | |||
279 | DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force); | 278 | DetailLog("{0},BSCharacter.setForce,taint,force={1}", LocalID, _force); |
280 | BulletSimAPI.SetObjectForce(PhysicsScene.WorldID, LocalID, _force); | 279 | BulletSimAPI.SetObjectForce(PhysicsScene.WorldID, LocalID, _force); |
281 | }); | 280 | }); |
282 | } | 281 | } |
283 | } | 282 | } |
284 | 283 | ||
285 | public override int VehicleType { | 284 | public override int VehicleType { |
286 | get { return 0; } | 285 | get { return 0; } |
287 | set { return; } | 286 | set { return; } |
288 | } | 287 | } |
289 | public override void VehicleFloatParam(int param, float value) { } | 288 | public override void VehicleFloatParam(int param, float value) { } |
290 | public override void VehicleVectorParam(int param, OMV.Vector3 value) {} | 289 | public override void VehicleVectorParam(int param, OMV.Vector3 value) {} |
@@ -296,8 +295,8 @@ public class BSCharacter : BSPhysObject | |||
296 | 295 | ||
297 | public override OMV.Vector3 GeometricCenter { get { return OMV.Vector3.Zero; } } | 296 | public override OMV.Vector3 GeometricCenter { get { return OMV.Vector3.Zero; } } |
298 | public override OMV.Vector3 CenterOfMass { get { return OMV.Vector3.Zero; } } | 297 | public override OMV.Vector3 CenterOfMass { get { return OMV.Vector3.Zero; } } |
299 | public override OMV.Vector3 Velocity { | 298 | public override OMV.Vector3 Velocity { |
300 | get { return _velocity; } | 299 | get { return _velocity; } |
301 | set { | 300 | set { |
302 | _velocity = value; | 301 | _velocity = value; |
303 | // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, _velocity); | 302 | // m_log.DebugFormat("{0}: set velocity = {1}", LogHeader, _velocity); |
@@ -306,24 +305,24 @@ public class BSCharacter : BSPhysObject | |||
306 | DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, _velocity); | 305 | DetailLog("{0},BSCharacter.setVelocity,taint,vel={1}", LocalID, _velocity); |
307 | BulletSimAPI.SetObjectVelocity(PhysicsScene.WorldID, LocalID, _velocity); | 306 | BulletSimAPI.SetObjectVelocity(PhysicsScene.WorldID, LocalID, _velocity); |
308 | }); | 307 | }); |
309 | } | 308 | } |
310 | } | 309 | } |
311 | public override OMV.Vector3 Torque { | 310 | public override OMV.Vector3 Torque { |
312 | get { return _torque; } | 311 | get { return _torque; } |
313 | set { _torque = value; | 312 | set { _torque = value; |
314 | } | 313 | } |
315 | } | 314 | } |
316 | public override float CollisionScore { | 315 | public override float CollisionScore { |
317 | get { return _collisionScore; } | 316 | get { return _collisionScore; } |
318 | set { _collisionScore = value; | 317 | set { _collisionScore = value; |
319 | } | 318 | } |
320 | } | 319 | } |
321 | public override OMV.Vector3 Acceleration { | 320 | public override OMV.Vector3 Acceleration { |
322 | get { return _acceleration; } | 321 | get { return _acceleration; } |
323 | set { _acceleration = value; } | 322 | set { _acceleration = value; } |
324 | } | 323 | } |
325 | public override OMV.Quaternion Orientation { | 324 | public override OMV.Quaternion Orientation { |
326 | get { return _orientation; } | 325 | get { return _orientation; } |
327 | set { | 326 | set { |
328 | _orientation = value; | 327 | _orientation = value; |
329 | // m_log.DebugFormat("{0}: set orientation to {1}", LogHeader, _orientation); | 328 | // m_log.DebugFormat("{0}: set orientation to {1}", LogHeader, _orientation); |
@@ -332,98 +331,98 @@ public class BSCharacter : BSPhysObject | |||
332 | // _position = BulletSimAPI.GetObjectPosition(Scene.WorldID, _localID); | 331 | // _position = BulletSimAPI.GetObjectPosition(Scene.WorldID, _localID); |
333 | BulletSimAPI.SetObjectTranslation(PhysicsScene.WorldID, LocalID, _position, _orientation); | 332 | BulletSimAPI.SetObjectTranslation(PhysicsScene.WorldID, LocalID, _position, _orientation); |
334 | }); | 333 | }); |
335 | } | 334 | } |
336 | } | 335 | } |
337 | public override int PhysicsActorType { | 336 | public override int PhysicsActorType { |
338 | get { return _physicsActorType; } | 337 | get { return _physicsActorType; } |
339 | set { _physicsActorType = value; | 338 | set { _physicsActorType = value; |
340 | } | 339 | } |
341 | } | 340 | } |
342 | public override bool IsPhysical { | 341 | public override bool IsPhysical { |
343 | get { return _isPhysical; } | 342 | get { return _isPhysical; } |
344 | set { _isPhysical = value; | 343 | set { _isPhysical = value; |
345 | } | 344 | } |
346 | } | 345 | } |
347 | public override bool Flying { | 346 | public override bool Flying { |
348 | get { return _flying; } | 347 | get { return _flying; } |
349 | set { | 348 | set { |
350 | _flying = value; | 349 | _flying = value; |
351 | // simulate flying by changing the effect of gravity | 350 | // simulate flying by changing the effect of gravity |
352 | this.Buoyancy = ComputeBuoyancyFromFlying(_flying); | 351 | this.Buoyancy = ComputeBuoyancyFromFlying(_flying); |
353 | } | 352 | } |
354 | } | 353 | } |
355 | // Flying is implimented by changing the avatar's buoyancy. | 354 | // Flying is implimented by changing the avatar's buoyancy. |
356 | // Would this be done better with a vehicle type? | 355 | // Would this be done better with a vehicle type? |
357 | private float ComputeBuoyancyFromFlying(bool ifFlying) { | 356 | private float ComputeBuoyancyFromFlying(bool ifFlying) { |
358 | return ifFlying ? 1f : 0f; | 357 | return ifFlying ? 1f : 0f; |
359 | } | 358 | } |
360 | public override bool | 359 | public override bool |
361 | SetAlwaysRun { | 360 | SetAlwaysRun { |
362 | get { return _setAlwaysRun; } | 361 | get { return _setAlwaysRun; } |
363 | set { _setAlwaysRun = value; } | 362 | set { _setAlwaysRun = value; } |
364 | } | 363 | } |
365 | public override bool ThrottleUpdates { | 364 | public override bool ThrottleUpdates { |
366 | get { return _throttleUpdates; } | 365 | get { return _throttleUpdates; } |
367 | set { _throttleUpdates = value; } | 366 | set { _throttleUpdates = value; } |
368 | } | 367 | } |
369 | public override bool IsColliding { | 368 | public override bool IsColliding { |
370 | get { return (CollidingStep == PhysicsScene.SimulationStep); } | 369 | get { return (CollidingStep == PhysicsScene.SimulationStep); } |
371 | set { _isColliding = value; } | 370 | set { _isColliding = value; } |
372 | } | 371 | } |
373 | public override bool CollidingGround { | 372 | public override bool CollidingGround { |
374 | get { return (CollidingGroundStep == PhysicsScene.SimulationStep); } | 373 | get { return (CollidingGroundStep == PhysicsScene.SimulationStep); } |
375 | set { CollidingGround = value; } | 374 | set { CollidingGround = value; } |
376 | } | 375 | } |
377 | public override bool CollidingObj { | 376 | public override bool CollidingObj { |
378 | get { return _collidingObj; } | 377 | get { return _collidingObj; } |
379 | set { _collidingObj = value; } | 378 | set { _collidingObj = value; } |
380 | } | 379 | } |
381 | public override bool FloatOnWater { | 380 | public override bool FloatOnWater { |
382 | set { _floatOnWater = value; } | 381 | set { _floatOnWater = value; } |
383 | } | 382 | } |
384 | public override OMV.Vector3 RotationalVelocity { | 383 | public override OMV.Vector3 RotationalVelocity { |
385 | get { return _rotationalVelocity; } | 384 | get { return _rotationalVelocity; } |
386 | set { _rotationalVelocity = value; } | 385 | set { _rotationalVelocity = value; } |
387 | } | 386 | } |
388 | public override bool Kinematic { | 387 | public override bool Kinematic { |
389 | get { return _kinematic; } | 388 | get { return _kinematic; } |
390 | set { _kinematic = value; } | 389 | set { _kinematic = value; } |
391 | } | 390 | } |
392 | // neg=fall quickly, 0=1g, 1=0g, pos=float up | 391 | // neg=fall quickly, 0=1g, 1=0g, pos=float up |
393 | public override float Buoyancy { | 392 | public override float Buoyancy { |
394 | get { return _buoyancy; } | 393 | get { return _buoyancy; } |
395 | set { _buoyancy = value; | 394 | set { _buoyancy = value; |
396 | PhysicsScene.TaintedObject("BSCharacter.setBuoyancy", delegate() | 395 | PhysicsScene.TaintedObject("BSCharacter.setBuoyancy", delegate() |
397 | { | 396 | { |
398 | DetailLog("{0},BSCharacter.setBuoyancy,taint,buoy={1}", LocalID, _buoyancy); | 397 | DetailLog("{0},BSCharacter.setBuoyancy,taint,buoy={1}", LocalID, _buoyancy); |
399 | BulletSimAPI.SetObjectBuoyancy(PhysicsScene.WorldID, LocalID, _buoyancy); | 398 | BulletSimAPI.SetObjectBuoyancy(PhysicsScene.WorldID, LocalID, _buoyancy); |
400 | }); | 399 | }); |
401 | } | 400 | } |
402 | } | 401 | } |
403 | 402 | ||
404 | // Used for MoveTo | 403 | // Used for MoveTo |
405 | public override OMV.Vector3 PIDTarget { | 404 | public override OMV.Vector3 PIDTarget { |
406 | set { _PIDTarget = value; } | 405 | set { _PIDTarget = value; } |
407 | } | 406 | } |
408 | public override bool PIDActive { | 407 | public override bool PIDActive { |
409 | set { _usePID = value; } | 408 | set { _usePID = value; } |
410 | } | 409 | } |
411 | public override float PIDTau { | 410 | public override float PIDTau { |
412 | set { _PIDTau = value; } | 411 | set { _PIDTau = value; } |
413 | } | 412 | } |
414 | 413 | ||
415 | // Used for llSetHoverHeight and maybe vehicle height | 414 | // Used for llSetHoverHeight and maybe vehicle height |
416 | // Hover Height will override MoveTo target's Z | 415 | // Hover Height will override MoveTo target's Z |
417 | public override bool PIDHoverActive { | 416 | public override bool PIDHoverActive { |
418 | set { _useHoverPID = value; } | 417 | set { _useHoverPID = value; } |
419 | } | 418 | } |
420 | public override float PIDHoverHeight { | 419 | public override float PIDHoverHeight { |
421 | set { _PIDHoverHeight = value; } | 420 | set { _PIDHoverHeight = value; } |
422 | } | 421 | } |
423 | public override PIDHoverType PIDHoverType { | 422 | public override PIDHoverType PIDHoverType { |
424 | set { _PIDHoverType = value; } | 423 | set { _PIDHoverType = value; } |
425 | } | 424 | } |
426 | public override float PIDHoverTau { | 425 | public override float PIDHoverTau { |
427 | set { _PIDHoverTao = value; } | 426 | set { _PIDHoverTao = value; } |
428 | } | 427 | } |
429 | 428 | ||
@@ -433,7 +432,7 @@ public class BSCharacter : BSPhysObject | |||
433 | public override float APIDStrength { set { return; } } | 432 | public override float APIDStrength { set { return; } } |
434 | public override float APIDDamping { set { return; } } | 433 | public override float APIDDamping { set { return; } } |
435 | 434 | ||
436 | public override void AddForce(OMV.Vector3 force, bool pushforce) { | 435 | public override void AddForce(OMV.Vector3 force, bool pushforce) { |
437 | if (force.IsFinite()) | 436 | if (force.IsFinite()) |
438 | { | 437 | { |
439 | _force.X += force.X; | 438 | _force.X += force.X; |
@@ -453,9 +452,9 @@ public class BSCharacter : BSPhysObject | |||
453 | //m_lastUpdateSent = false; | 452 | //m_lastUpdateSent = false; |
454 | } | 453 | } |
455 | 454 | ||
456 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { | 455 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { |
457 | } | 456 | } |
458 | public override void SetMomentum(OMV.Vector3 momentum) { | 457 | public override void SetMomentum(OMV.Vector3 momentum) { |
459 | } | 458 | } |
460 | 459 | ||
461 | private void ComputeAvatarScale(OMV.Vector3 size) | 460 | private void ComputeAvatarScale(OMV.Vector3 size) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index cf33d0e..65b38d6 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -491,7 +491,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
491 | // remember the position so next step we can limit absolute movement effects | 491 | // remember the position so next step we can limit absolute movement effects |
492 | m_lastPositionVector = Prim.Position; | 492 | m_lastPositionVector = Prim.Position; |
493 | 493 | ||
494 | VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}", | 494 | VDetailLog("{0},BSDynamics.Step,done,pos={1},force={2},velocity={3},angvel={4}", |
495 | Prim.LocalID, Prim.Position, Prim.Force, Prim.Velocity, Prim.RotationalVelocity); | 495 | Prim.LocalID, Prim.Position, Prim.Force, Prim.Velocity, Prim.RotationalVelocity); |
496 | }// end Step | 496 | }// end Step |
497 | 497 | ||
@@ -511,8 +511,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
511 | Vector3 addAmount = (m_linearMotorDirection - m_lastLinearVelocityVector)/(m_linearMotorTimescale / pTimestep); | 511 | Vector3 addAmount = (m_linearMotorDirection - m_lastLinearVelocityVector)/(m_linearMotorTimescale / pTimestep); |
512 | // lastLinearVelocityVector is the current body velocity vector | 512 | // lastLinearVelocityVector is the current body velocity vector |
513 | // RA: Not sure what the *10 is for. A correction for pTimestep? | 513 | // RA: Not sure what the *10 is for. A correction for pTimestep? |
514 | // m_lastLinearVelocityVector += (addAmount*10); | 514 | // m_lastLinearVelocityVector += (addAmount*10); |
515 | m_lastLinearVelocityVector += addAmount; | 515 | m_lastLinearVelocityVector += addAmount; |
516 | 516 | ||
517 | // Limit the velocity vector to less than the last set linear motor direction | 517 | // Limit the velocity vector to less than the last set linear motor direction |
518 | if (Math.Abs(m_lastLinearVelocityVector.X) > Math.Abs(m_linearMotorDirectionLASTSET.X)) | 518 | if (Math.Abs(m_lastLinearVelocityVector.X) > Math.Abs(m_linearMotorDirectionLASTSET.X)) |
@@ -695,7 +695,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
695 | Vector3 keepFraction = Vector3.One - (Vector3.One / (m_linearFrictionTimescale / pTimestep)); | 695 | Vector3 keepFraction = Vector3.One - (Vector3.One / (m_linearFrictionTimescale / pTimestep)); |
696 | m_lastLinearVelocityVector *= keepFraction; | 696 | m_lastLinearVelocityVector *= keepFraction; |
697 | 697 | ||
698 | VDetailLog("{0},MoveLinear,done,lmDir={1},lmVel={2},newVel={3},grav={4},1Mdecay={5}", | 698 | VDetailLog("{0},MoveLinear,done,lmDir={1},lmVel={2},newVel={3},grav={4},1Mdecay={5}", |
699 | Prim.LocalID, m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity, grav, keepFraction); | 699 | Prim.LocalID, m_linearMotorDirection, m_lastLinearVelocityVector, m_newVelocity, grav, keepFraction); |
700 | 700 | ||
701 | } // end MoveLinear() | 701 | } // end MoveLinear() |
@@ -728,7 +728,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
728 | m_angularMotorVelocity.Y += (m_angularMotorDirection.Y - m_angularMotorVelocity.Y) / (m_angularMotorTimescale / pTimestep); | 728 | m_angularMotorVelocity.Y += (m_angularMotorDirection.Y - m_angularMotorVelocity.Y) / (m_angularMotorTimescale / pTimestep); |
729 | m_angularMotorVelocity.Z += (m_angularMotorDirection.Z - m_angularMotorVelocity.Z) / (m_angularMotorTimescale / pTimestep); | 729 | m_angularMotorVelocity.Z += (m_angularMotorDirection.Z - m_angularMotorVelocity.Z) / (m_angularMotorTimescale / pTimestep); |
730 | 730 | ||
731 | VDetailLog("{0},MoveAngular,angularMotorApply,apply={1},angTScale={2},timeStep={3},origvel={4},dir={5},vel={6}", | 731 | VDetailLog("{0},MoveAngular,angularMotorApply,apply={1},angTScale={2},timeStep={3},origvel={4},dir={5},vel={6}", |
732 | Prim.LocalID, m_angularMotorApply, m_angularMotorTimescale, pTimestep, origAngularVelocity, m_angularMotorDirection, m_angularMotorVelocity); | 732 | Prim.LocalID, m_angularMotorApply, m_angularMotorTimescale, pTimestep, origAngularVelocity, m_angularMotorDirection, m_angularMotorVelocity); |
733 | 733 | ||
734 | // This is done so that if script request rate is less than phys frame rate the expected | 734 | // This is done so that if script request rate is less than phys frame rate the expected |
@@ -779,7 +779,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
779 | vertattr.X += bounce * angularVelocity.X; | 779 | vertattr.X += bounce * angularVelocity.X; |
780 | vertattr.Y += bounce * angularVelocity.Y; | 780 | vertattr.Y += bounce * angularVelocity.Y; |
781 | 781 | ||
782 | VDetailLog("{0},MoveAngular,verticalAttraction,verterr={1},bounce={2},vertattr={3}", | 782 | VDetailLog("{0},MoveAngular,verticalAttraction,verterr={1},bounce={2},vertattr={3}", |
783 | Prim.LocalID, verterr, bounce, vertattr); | 783 | Prim.LocalID, verterr, bounce, vertattr); |
784 | 784 | ||
785 | } // else vertical attractor is off | 785 | } // else vertical attractor is off |
@@ -792,7 +792,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
792 | 792 | ||
793 | // Sum velocities | 793 | // Sum velocities |
794 | m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection | 794 | m_lastAngularVelocity = m_angularMotorVelocity + vertattr; // + bank + deflection |
795 | 795 | ||
796 | if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) | 796 | if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) |
797 | { | 797 | { |
798 | m_lastAngularVelocity.X = 0; | 798 | m_lastAngularVelocity.X = 0; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index 6967108..b0cc63c 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs | |||
@@ -53,9 +53,9 @@ public class BSLinkset | |||
53 | 53 | ||
54 | // We keep the prim's mass in the linkset structure since it could be dependent on other prims | 54 | // We keep the prim's mass in the linkset structure since it could be dependent on other prims |
55 | private float m_mass; | 55 | private float m_mass; |
56 | public float LinksetMass | 56 | public float LinksetMass |
57 | { | 57 | { |
58 | get | 58 | get |
59 | { | 59 | { |
60 | m_mass = ComputeLinksetMass(); | 60 | m_mass = ComputeLinksetMass(); |
61 | return m_mass; | 61 | return m_mass; |
@@ -77,7 +77,7 @@ public class BSLinkset | |||
77 | // A simple linkset of one (no children) | 77 | // A simple linkset of one (no children) |
78 | LinksetID = m_nextLinksetID++; | 78 | LinksetID = m_nextLinksetID++; |
79 | // We create LOTS of linksets. | 79 | // We create LOTS of linksets. |
80 | if (m_nextLinksetID <= 0) | 80 | if (m_nextLinksetID <= 0) |
81 | m_nextLinksetID = 1; | 81 | m_nextLinksetID = 1; |
82 | PhysicsScene = scene; | 82 | PhysicsScene = scene; |
83 | LinksetRoot = parent; | 83 | LinksetRoot = parent; |
@@ -276,7 +276,7 @@ public class BSLinkset | |||
276 | BSConstraint constrain; | 276 | BSConstraint constrain; |
277 | if (PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.BSBody, child.BSBody, out constrain)) | 277 | if (PhysicsScene.Constraints.TryGetConstraint(LinksetRoot.BSBody, child.BSBody, out constrain)) |
278 | { | 278 | { |
279 | // DetailLog("{0},BSLinkset.RecomputeLinksetConstraintVariables,taint,child={1},mass={2},A={3},B={4}", | 279 | // DetailLog("{0},BSLinkset.RecomputeLinksetConstraintVariables,taint,child={1},mass={2},A={3},B={4}", |
280 | // LinksetRoot.LocalID, child.LocalID, linksetMass, constrain.Body1.ID, constrain.Body2.ID); | 280 | // LinksetRoot.LocalID, child.LocalID, linksetMass, constrain.Body1.ID, constrain.Body2.ID); |
281 | constrain.RecomputeConstraintVariables(linksetMass); | 281 | constrain.RecomputeConstraintVariables(linksetMass); |
282 | } | 282 | } |
@@ -392,14 +392,14 @@ public class BSLinkset | |||
392 | 392 | ||
393 | // create a constraint that allows no freedom of movement between the two objects | 393 | // create a constraint that allows no freedom of movement between the two objects |
394 | // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818 | 394 | // http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=4818 |
395 | DetailLog("{0},PhysicallyLinkAChildToRoot,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}", | 395 | DetailLog("{0},PhysicallyLinkAChildToRoot,taint,root={1},rBody={2},child={3},cBody={4},rLoc={5},cLoc={6},midLoc={7}", |
396 | rootPrim.LocalID, | 396 | rootPrim.LocalID, |
397 | rootPrim.LocalID, rootBody.ptr.ToString("X"), | 397 | rootPrim.LocalID, rootBody.ptr.ToString("X"), |
398 | childPrim.LocalID, childBody.ptr.ToString("X"), | 398 | childPrim.LocalID, childBody.ptr.ToString("X"), |
399 | rootPrim.Position, childPrim.Position, midPoint); | 399 | rootPrim.Position, childPrim.Position, midPoint); |
400 | 400 | ||
401 | // There is great subtlty in these paramters. Notice the check for a ptr of zero. | 401 | // There is great subtlty in these paramters. Notice the check for a ptr of zero. |
402 | // We pass the BulletBody structure into the taint in order to capture the pointer | 402 | // We pass the BulletBody structure into the taint in order to capture the pointer |
403 | // of the body at the time of constraint creation. This doesn't work for the very first | 403 | // of the body at the time of constraint creation. This doesn't work for the very first |
404 | // construction because there is no body yet. The body | 404 | // construction because there is no body yet. The body |
405 | // is constructed later at taint time. Thus we use the body address at time of the | 405 | // is constructed later at taint time. Thus we use the body address at time of the |
@@ -409,8 +409,8 @@ public class BSLinkset | |||
409 | // to only change BSShape at taint time thus syncronizing these operations at | 409 | // to only change BSShape at taint time thus syncronizing these operations at |
410 | // the cost of efficiency and lag. | 410 | // the cost of efficiency and lag. |
411 | BS6DofConstraint constrain = new BS6DofConstraint( | 411 | BS6DofConstraint constrain = new BS6DofConstraint( |
412 | PhysicsScene.World, | 412 | PhysicsScene.World, |
413 | rootBody.ptr == IntPtr.Zero ? rootPrim.BSBody : rootBody, | 413 | rootBody.ptr == IntPtr.Zero ? rootPrim.BSBody : rootBody, |
414 | childBody.ptr == IntPtr.Zero ? childPrim.BSBody : childBody, | 414 | childBody.ptr == IntPtr.Zero ? childPrim.BSBody : childBody, |
415 | midPoint, | 415 | midPoint, |
416 | true, | 416 | true, |
@@ -473,11 +473,11 @@ public class BSLinkset | |||
473 | // The root and child bodies are passed in because we need to remove the constraint between | 473 | // The root and child bodies are passed in because we need to remove the constraint between |
474 | // the bodies that were at unlink time. | 474 | // the bodies that were at unlink time. |
475 | // Called at taint time! | 475 | // Called at taint time! |
476 | private void PhysicallyUnlinkAChildFromRoot(BSPhysObject rootPrim, BulletBody rootBody, | 476 | private void PhysicallyUnlinkAChildFromRoot(BSPhysObject rootPrim, BulletBody rootBody, |
477 | BSPhysObject childPrim, BulletBody childBody) | 477 | BSPhysObject childPrim, BulletBody childBody) |
478 | { | 478 | { |
479 | DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},rBody={2},child={3},cBody={4}", | 479 | DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},rBody={2},child={3},cBody={4}", |
480 | rootPrim.LocalID, | 480 | rootPrim.LocalID, |
481 | rootPrim.LocalID, rootBody.ptr.ToString("X"), | 481 | rootPrim.LocalID, rootBody.ptr.ToString("X"), |
482 | childPrim.LocalID, childBody.ptr.ToString("X")); | 482 | childPrim.LocalID, childBody.ptr.ToString("X")); |
483 | 483 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index df95625..d9b738b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -100,7 +100,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
100 | // The simulation step is telling this object about a collision. | 100 | // The simulation step is telling this object about a collision. |
101 | // Return 'true' if a collision was processed and should be sent up. | 101 | // Return 'true' if a collision was processed and should be sent up. |
102 | // Called at taint time from within the Step() function | 102 | // Called at taint time from within the Step() function |
103 | public virtual bool Collide(uint collidingWith, BSPhysObject collidee, | 103 | public virtual bool Collide(uint collidingWith, BSPhysObject collidee, |
104 | OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) | 104 | OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) |
105 | { | 105 | { |
106 | bool ret = false; | 106 | bool ret = false; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs index 0f027b8..20f5180 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs | |||
@@ -33,7 +33,7 @@ using OpenMetaverse; | |||
33 | namespace OpenSim.Region.Physics.BulletSPlugin | 33 | namespace OpenSim.Region.Physics.BulletSPlugin |
34 | { | 34 | { |
35 | /// <summary> | 35 | /// <summary> |
36 | /// Entry for a port of Bullet (http://bulletphysics.org/) to OpenSim. | 36 | /// Entry for a port of Bullet (http://bulletphysics.org/) to OpenSim. |
37 | /// This module interfaces to an unmanaged C++ library which makes the | 37 | /// This module interfaces to an unmanaged C++ library which makes the |
38 | /// actual calls into the Bullet physics engine. | 38 | /// actual calls into the Bullet physics engine. |
39 | /// The unmanaged library is found in opensim-libs::trunk/unmanaged/BulletSim/. | 39 | /// The unmanaged library is found in opensim-libs::trunk/unmanaged/BulletSim/. |
@@ -62,7 +62,7 @@ public class BSPlugin : IPhysicsPlugin | |||
62 | if (Util.IsWindows()) | 62 | if (Util.IsWindows()) |
63 | Util.LoadArchSpecificWindowsDll("BulletSim.dll"); | 63 | Util.LoadArchSpecificWindowsDll("BulletSim.dll"); |
64 | // If not Windows, loading is performed by the | 64 | // If not Windows, loading is performed by the |
65 | // Mono loader as specified in | 65 | // Mono loader as specified in |
66 | // "bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config". | 66 | // "bin/Physics/OpenSim.Region.Physics.BulletSPlugin.dll.config". |
67 | 67 | ||
68 | _mScene = new BSScene(sceneIdentifier); | 68 | _mScene = new BSScene(sceneIdentifier); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index e65e42b..8688485 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -158,12 +158,12 @@ public sealed class BSPrim : BSPhysObject | |||
158 | BulletSimAPI.DestroyObject(PhysicsScene.WorldID, LocalID); | 158 | BulletSimAPI.DestroyObject(PhysicsScene.WorldID, LocalID); |
159 | }); | 159 | }); |
160 | } | 160 | } |
161 | 161 | ||
162 | public override bool Stopped { | 162 | public override bool Stopped { |
163 | get { return _stopped; } | 163 | get { return _stopped; } |
164 | } | 164 | } |
165 | public override OMV.Vector3 Size { | 165 | public override OMV.Vector3 Size { |
166 | get { return _size; } | 166 | get { return _size; } |
167 | set { | 167 | set { |
168 | _size = value; | 168 | _size = value; |
169 | PhysicsScene.TaintedObject("BSPrim.setSize", delegate() | 169 | PhysicsScene.TaintedObject("BSPrim.setSize", delegate() |
@@ -174,7 +174,7 @@ public sealed class BSPrim : BSPhysObject | |||
174 | CreateGeomAndObject(true); | 174 | CreateGeomAndObject(true); |
175 | // DetailLog("{0},BSPrim.setSize,size={1},scale={2},mass={3},physical={4}", LocalID, _size, _scale, _mass, IsPhysical); | 175 | // DetailLog("{0},BSPrim.setSize,size={1},scale={2},mass={3},physical={4}", LocalID, _size, _scale, _mass, IsPhysical); |
176 | }); | 176 | }); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | // Scale is what we set in the physics engine. It is different than 'size' in that | 179 | // Scale is what we set in the physics engine. It is different than 'size' in that |
180 | // 'size' can be encorporated into the mesh. In that case, the scale is <1,1,1>. | 180 | // 'size' can be encorporated into the mesh. In that case, the scale is <1,1,1>. |
@@ -183,7 +183,7 @@ public sealed class BSPrim : BSPhysObject | |||
183 | get { return _scale; } | 183 | get { return _scale; } |
184 | set { _scale = value; } | 184 | set { _scale = value; } |
185 | } | 185 | } |
186 | public override PrimitiveBaseShape Shape { | 186 | public override PrimitiveBaseShape Shape { |
187 | set { | 187 | set { |
188 | _pbs = value; | 188 | _pbs = value; |
189 | PhysicsScene.TaintedObject("BSPrim.setShape", delegate() | 189 | PhysicsScene.TaintedObject("BSPrim.setShape", delegate() |
@@ -191,13 +191,13 @@ public sealed class BSPrim : BSPhysObject | |||
191 | _mass = CalculateMass(); // changing the shape changes the mass | 191 | _mass = CalculateMass(); // changing the shape changes the mass |
192 | CreateGeomAndObject(true); | 192 | CreateGeomAndObject(true); |
193 | }); | 193 | }); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | public override bool Grabbed { | 196 | public override bool Grabbed { |
197 | set { _grabbed = value; | 197 | set { _grabbed = value; |
198 | } | 198 | } |
199 | } | 199 | } |
200 | public override bool Selected { | 200 | public override bool Selected { |
201 | set { | 201 | set { |
202 | _isSelected = value; | 202 | _isSelected = value; |
203 | PhysicsScene.TaintedObject("BSPrim.setSelected", delegate() | 203 | PhysicsScene.TaintedObject("BSPrim.setSelected", delegate() |
@@ -205,7 +205,7 @@ public sealed class BSPrim : BSPhysObject | |||
205 | // DetailLog("{0},BSPrim.selected,taint,selected={1}", LocalID, _isSelected); | 205 | // DetailLog("{0},BSPrim.selected,taint,selected={1}", LocalID, _isSelected); |
206 | SetObjectDynamic(false); | 206 | SetObjectDynamic(false); |
207 | }); | 207 | }); |
208 | } | 208 | } |
209 | } | 209 | } |
210 | public override void CrossingFailure() { return; } | 210 | public override void CrossingFailure() { return; } |
211 | 211 | ||
@@ -219,10 +219,10 @@ public sealed class BSPrim : BSPhysObject | |||
219 | 219 | ||
220 | Linkset = parent.Linkset.AddMeToLinkset(this); | 220 | Linkset = parent.Linkset.AddMeToLinkset(this); |
221 | 221 | ||
222 | DetailLog("{0},BSPrim.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}", | 222 | DetailLog("{0},BSPrim.link,call,parentBefore={1}, childrenBefore=={2}, parentAfter={3}, childrenAfter={4}", |
223 | LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren); | 223 | LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren); |
224 | } | 224 | } |
225 | return; | 225 | return; |
226 | } | 226 | } |
227 | 227 | ||
228 | // delink me from my linkset | 228 | // delink me from my linkset |
@@ -232,12 +232,12 @@ public sealed class BSPrim : BSPhysObject | |||
232 | 232 | ||
233 | BSPhysObject parentBefore = Linkset.LinksetRoot; | 233 | BSPhysObject parentBefore = Linkset.LinksetRoot; |
234 | int childrenBefore = Linkset.NumberOfChildren; | 234 | int childrenBefore = Linkset.NumberOfChildren; |
235 | 235 | ||
236 | Linkset = Linkset.RemoveMeFromLinkset(this); | 236 | Linkset = Linkset.RemoveMeFromLinkset(this); |
237 | 237 | ||
238 | DetailLog("{0},BSPrim.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ", | 238 | DetailLog("{0},BSPrim.delink,parentBefore={1},childrenBefore={2},parentAfter={3},childrenAfter={4}, ", |
239 | LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren); | 239 | LocalID, parentBefore.LocalID, childrenBefore, Linkset.LinksetRoot.LocalID, Linkset.NumberOfChildren); |
240 | return; | 240 | return; |
241 | } | 241 | } |
242 | 242 | ||
243 | // Set motion values to zero. | 243 | // Set motion values to zero. |
@@ -258,21 +258,21 @@ public sealed class BSPrim : BSPhysObject | |||
258 | } | 258 | } |
259 | 259 | ||
260 | public override void LockAngularMotion(OMV.Vector3 axis) | 260 | public override void LockAngularMotion(OMV.Vector3 axis) |
261 | { | 261 | { |
262 | DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); | 262 | DetailLog("{0},BSPrim.LockAngularMotion,call,axis={1}", LocalID, axis); |
263 | return; | 263 | return; |
264 | } | 264 | } |
265 | 265 | ||
266 | public override OMV.Vector3 Position { | 266 | public override OMV.Vector3 Position { |
267 | get { | 267 | get { |
268 | if (!Linkset.IsRoot(this)) | 268 | if (!Linkset.IsRoot(this)) |
269 | // child prims move around based on their parent. Need to get the latest location | 269 | // child prims move around based on their parent. Need to get the latest location |
270 | _position = BulletSimAPI.GetPosition2(BSBody.ptr); | 270 | _position = BulletSimAPI.GetPosition2(BSBody.ptr); |
271 | 271 | ||
272 | // don't do the GetObjectPosition for root elements because this function is called a zillion times | 272 | // don't do the GetObjectPosition for root elements because this function is called a zillion times |
273 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); | 273 | // _position = BulletSimAPI.GetObjectPosition2(PhysicsScene.World.ptr, BSBody.ptr); |
274 | return _position; | 274 | return _position; |
275 | } | 275 | } |
276 | set { | 276 | set { |
277 | _position = value; | 277 | _position = value; |
278 | // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? | 278 | // TODO: what does it mean to set the position of a child prim?? Rebuild the constraint? |
@@ -281,13 +281,13 @@ public sealed class BSPrim : BSPhysObject | |||
281 | // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 281 | // DetailLog("{0},BSPrim.SetPosition,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
282 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 282 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); |
283 | }); | 283 | }); |
284 | } | 284 | } |
285 | } | 285 | } |
286 | 286 | ||
287 | // Return the effective mass of the object. | 287 | // Return the effective mass of the object. |
288 | // If there are multiple items in the linkset, add them together for the root | 288 | // If there are multiple items in the linkset, add them together for the root |
289 | public override float Mass | 289 | public override float Mass |
290 | { | 290 | { |
291 | get | 291 | get |
292 | { | 292 | { |
293 | // return Linkset.LinksetMass; | 293 | // return Linkset.LinksetMass; |
@@ -310,8 +310,8 @@ public sealed class BSPrim : BSPhysObject | |||
310 | get { return Linkset.GeometricCenter; } | 310 | get { return Linkset.GeometricCenter; } |
311 | } | 311 | } |
312 | 312 | ||
313 | public override OMV.Vector3 Force { | 313 | public override OMV.Vector3 Force { |
314 | get { return _force; } | 314 | get { return _force; } |
315 | set { | 315 | set { |
316 | _force = value; | 316 | _force = value; |
317 | PhysicsScene.TaintedObject("BSPrim.setForce", delegate() | 317 | PhysicsScene.TaintedObject("BSPrim.setForce", delegate() |
@@ -319,13 +319,13 @@ public sealed class BSPrim : BSPhysObject | |||
319 | // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); | 319 | // DetailLog("{0},BSPrim.setForce,taint,force={1}", LocalID, _force); |
320 | BulletSimAPI.SetObjectForce2(BSBody.ptr, _force); | 320 | BulletSimAPI.SetObjectForce2(BSBody.ptr, _force); |
321 | }); | 321 | }); |
322 | } | 322 | } |
323 | } | 323 | } |
324 | 324 | ||
325 | public override int VehicleType { | 325 | public override int VehicleType { |
326 | get { | 326 | get { |
327 | return (int)_vehicle.Type; // if we are a vehicle, return that type | 327 | return (int)_vehicle.Type; // if we are a vehicle, return that type |
328 | } | 328 | } |
329 | set { | 329 | set { |
330 | Vehicle type = (Vehicle)value; | 330 | Vehicle type = (Vehicle)value; |
331 | BSPrim vehiclePrim = this; | 331 | BSPrim vehiclePrim = this; |
@@ -337,30 +337,30 @@ public sealed class BSPrim : BSPhysObject | |||
337 | // Tell the scene about the vehicle so it will get processing each frame. | 337 | // Tell the scene about the vehicle so it will get processing each frame. |
338 | PhysicsScene.VehicleInSceneTypeChanged(this, type); | 338 | PhysicsScene.VehicleInSceneTypeChanged(this, type); |
339 | }); | 339 | }); |
340 | } | 340 | } |
341 | } | 341 | } |
342 | public override void VehicleFloatParam(int param, float value) | 342 | public override void VehicleFloatParam(int param, float value) |
343 | { | 343 | { |
344 | PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() | 344 | PhysicsScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() |
345 | { | 345 | { |
346 | _vehicle.ProcessFloatVehicleParam((Vehicle)param, value); | 346 | _vehicle.ProcessFloatVehicleParam((Vehicle)param, value); |
347 | }); | 347 | }); |
348 | } | 348 | } |
349 | public override void VehicleVectorParam(int param, OMV.Vector3 value) | 349 | public override void VehicleVectorParam(int param, OMV.Vector3 value) |
350 | { | 350 | { |
351 | PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() | 351 | PhysicsScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() |
352 | { | 352 | { |
353 | _vehicle.ProcessVectorVehicleParam((Vehicle)param, value); | 353 | _vehicle.ProcessVectorVehicleParam((Vehicle)param, value); |
354 | }); | 354 | }); |
355 | } | 355 | } |
356 | public override void VehicleRotationParam(int param, OMV.Quaternion rotation) | 356 | public override void VehicleRotationParam(int param, OMV.Quaternion rotation) |
357 | { | 357 | { |
358 | PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() | 358 | PhysicsScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() |
359 | { | 359 | { |
360 | _vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); | 360 | _vehicle.ProcessRotationVehicleParam((Vehicle)param, rotation); |
361 | }); | 361 | }); |
362 | } | 362 | } |
363 | public override void VehicleFlags(int param, bool remove) | 363 | public override void VehicleFlags(int param, bool remove) |
364 | { | 364 | { |
365 | PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate() | 365 | PhysicsScene.TaintedObject("BSPrim.VehicleFlags", delegate() |
366 | { | 366 | { |
@@ -388,11 +388,11 @@ public sealed class BSPrim : BSPhysObject | |||
388 | SetObjectDynamic(true); | 388 | SetObjectDynamic(true); |
389 | }); | 389 | }); |
390 | } | 390 | } |
391 | return; | 391 | return; |
392 | } | 392 | } |
393 | 393 | ||
394 | public override OMV.Vector3 Velocity { | 394 | public override OMV.Vector3 Velocity { |
395 | get { return _velocity; } | 395 | get { return _velocity; } |
396 | set { | 396 | set { |
397 | _velocity = value; | 397 | _velocity = value; |
398 | PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate() | 398 | PhysicsScene.TaintedObject("BSPrim.setVelocity", delegate() |
@@ -400,24 +400,24 @@ public sealed class BSPrim : BSPhysObject | |||
400 | // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); | 400 | // DetailLog("{0},BSPrim.SetVelocity,taint,vel={1}", LocalID, _velocity); |
401 | BulletSimAPI.SetLinearVelocity2(BSBody.ptr, _velocity); | 401 | BulletSimAPI.SetLinearVelocity2(BSBody.ptr, _velocity); |
402 | }); | 402 | }); |
403 | } | 403 | } |
404 | } | 404 | } |
405 | public override OMV.Vector3 Torque { | 405 | public override OMV.Vector3 Torque { |
406 | get { return _torque; } | 406 | get { return _torque; } |
407 | set { _torque = value; | 407 | set { _torque = value; |
408 | // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); | 408 | // DetailLog("{0},BSPrim.SetTorque,call,torque={1}", LocalID, _torque); |
409 | } | 409 | } |
410 | } | 410 | } |
411 | public override float CollisionScore { | 411 | public override float CollisionScore { |
412 | get { return _collisionScore; } | 412 | get { return _collisionScore; } |
413 | set { _collisionScore = value; | 413 | set { _collisionScore = value; |
414 | } | 414 | } |
415 | } | 415 | } |
416 | public override OMV.Vector3 Acceleration { | 416 | public override OMV.Vector3 Acceleration { |
417 | get { return _acceleration; } | 417 | get { return _acceleration; } |
418 | set { _acceleration = value; } | 418 | set { _acceleration = value; } |
419 | } | 419 | } |
420 | public override OMV.Quaternion Orientation { | 420 | public override OMV.Quaternion Orientation { |
421 | get { | 421 | get { |
422 | if (!Linkset.IsRoot(this)) | 422 | if (!Linkset.IsRoot(this)) |
423 | { | 423 | { |
@@ -425,7 +425,7 @@ public sealed class BSPrim : BSPhysObject | |||
425 | _orientation = BulletSimAPI.GetOrientation2(BSBody.ptr); | 425 | _orientation = BulletSimAPI.GetOrientation2(BSBody.ptr); |
426 | } | 426 | } |
427 | return _orientation; | 427 | return _orientation; |
428 | } | 428 | } |
429 | set { | 429 | set { |
430 | _orientation = value; | 430 | _orientation = value; |
431 | // TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint? | 431 | // TODO: what does it mean if a child in a linkset changes its orientation? Rebuild the constraint? |
@@ -435,14 +435,14 @@ public sealed class BSPrim : BSPhysObject | |||
435 | // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); | 435 | // DetailLog("{0},BSPrim.setOrientation,taint,pos={1},orient={2}", LocalID, _position, _orientation); |
436 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); | 436 | BulletSimAPI.SetTranslation2(BSBody.ptr, _position, _orientation); |
437 | }); | 437 | }); |
438 | } | 438 | } |
439 | } | 439 | } |
440 | public override int PhysicsActorType { | 440 | public override int PhysicsActorType { |
441 | get { return _physicsActorType; } | 441 | get { return _physicsActorType; } |
442 | set { _physicsActorType = value; } | 442 | set { _physicsActorType = value; } |
443 | } | 443 | } |
444 | public override bool IsPhysical { | 444 | public override bool IsPhysical { |
445 | get { return _isPhysical; } | 445 | get { return _isPhysical; } |
446 | set { | 446 | set { |
447 | if (_isPhysical != value) | 447 | if (_isPhysical != value) |
448 | { | 448 | { |
@@ -453,7 +453,7 @@ public sealed class BSPrim : BSPhysObject | |||
453 | SetObjectDynamic(true); | 453 | SetObjectDynamic(true); |
454 | }); | 454 | }); |
455 | } | 455 | } |
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
459 | // An object is static (does not move) if selected or not physical | 459 | // An object is static (does not move) if selected or not physical |
@@ -519,7 +519,7 @@ public sealed class BSPrim : BSPhysObject | |||
519 | // had been automatically disabled when the mass was set to zero. | 519 | // had been automatically disabled when the mass was set to zero. |
520 | Linkset.Refresh(this); | 520 | Linkset.Refresh(this); |
521 | 521 | ||
522 | DetailLog("{0},BSPrim.UpdatePhysicalParameters,exit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}", | 522 | DetailLog("{0},BSPrim.UpdatePhysicalParameters,exit,static={1},solid={2},mass={3},collide={4},cf={5:X},body={6},shape={7}", |
523 | LocalID, IsStatic, IsSolid, _mass, SubscribedEvents(), CurrentCollisionFlags, BSBody, BSShape); | 523 | LocalID, IsStatic, IsSolid, _mass, SubscribedEvents(), CurrentCollisionFlags, BSBody, BSShape); |
524 | } | 524 | } |
525 | 525 | ||
@@ -630,31 +630,31 @@ public sealed class BSPrim : BSPhysObject | |||
630 | } | 630 | } |
631 | 631 | ||
632 | // prims don't fly | 632 | // prims don't fly |
633 | public override bool Flying { | 633 | public override bool Flying { |
634 | get { return _flying; } | 634 | get { return _flying; } |
635 | set { | 635 | set { |
636 | _flying = value; | 636 | _flying = value; |
637 | } | 637 | } |
638 | } | 638 | } |
639 | public override bool SetAlwaysRun { | 639 | public override bool SetAlwaysRun { |
640 | get { return _setAlwaysRun; } | 640 | get { return _setAlwaysRun; } |
641 | set { _setAlwaysRun = value; } | 641 | set { _setAlwaysRun = value; } |
642 | } | 642 | } |
643 | public override bool ThrottleUpdates { | 643 | public override bool ThrottleUpdates { |
644 | get { return _throttleUpdates; } | 644 | get { return _throttleUpdates; } |
645 | set { _throttleUpdates = value; } | 645 | set { _throttleUpdates = value; } |
646 | } | 646 | } |
647 | public override bool IsColliding { | 647 | public override bool IsColliding { |
648 | get { return (CollidingStep == PhysicsScene.SimulationStep); } | 648 | get { return (CollidingStep == PhysicsScene.SimulationStep); } |
649 | set { _isColliding = value; } | 649 | set { _isColliding = value; } |
650 | } | 650 | } |
651 | public override bool CollidingGround { | 651 | public override bool CollidingGround { |
652 | get { return (CollidingGroundStep == PhysicsScene.SimulationStep); } | 652 | get { return (CollidingGroundStep == PhysicsScene.SimulationStep); } |
653 | set { _collidingGround = value; } | 653 | set { _collidingGround = value; } |
654 | } | 654 | } |
655 | public override bool CollidingObj { | 655 | public override bool CollidingObj { |
656 | get { return _collidingObj; } | 656 | get { return _collidingObj; } |
657 | set { _collidingObj = value; } | 657 | set { _collidingObj = value; } |
658 | } | 658 | } |
659 | public bool IsPhantom { | 659 | public bool IsPhantom { |
660 | get { | 660 | get { |
@@ -664,10 +664,10 @@ public sealed class BSPrim : BSPhysObject | |||
664 | return false; | 664 | return false; |
665 | } | 665 | } |
666 | } | 666 | } |
667 | public override bool FloatOnWater { | 667 | public override bool FloatOnWater { |
668 | set { _floatOnWater = value; } | 668 | set { _floatOnWater = value; } |
669 | } | 669 | } |
670 | public override OMV.Vector3 RotationalVelocity { | 670 | public override OMV.Vector3 RotationalVelocity { |
671 | get { | 671 | get { |
672 | /* | 672 | /* |
673 | OMV.Vector3 pv = OMV.Vector3.Zero; | 673 | OMV.Vector3 pv = OMV.Vector3.Zero; |
@@ -679,7 +679,7 @@ public sealed class BSPrim : BSPhysObject | |||
679 | */ | 679 | */ |
680 | 680 | ||
681 | return _rotationalVelocity; | 681 | return _rotationalVelocity; |
682 | } | 682 | } |
683 | set { | 683 | set { |
684 | _rotationalVelocity = value; | 684 | _rotationalVelocity = value; |
685 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); | 685 | // m_log.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity); |
@@ -688,16 +688,16 @@ public sealed class BSPrim : BSPhysObject | |||
688 | // DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); | 688 | // DetailLog("{0},BSPrim.SetRotationalVel,taint,rotvel={1}", LocalID, _rotationalVelocity); |
689 | BulletSimAPI.SetAngularVelocity2(BSBody.ptr, _rotationalVelocity); | 689 | BulletSimAPI.SetAngularVelocity2(BSBody.ptr, _rotationalVelocity); |
690 | }); | 690 | }); |
691 | } | 691 | } |
692 | } | 692 | } |
693 | public override bool Kinematic { | 693 | public override bool Kinematic { |
694 | get { return _kinematic; } | 694 | get { return _kinematic; } |
695 | set { _kinematic = value; | 695 | set { _kinematic = value; |
696 | // m_log.DebugFormat("{0}: Kinematic={1}", LogHeader, _kinematic); | 696 | // m_log.DebugFormat("{0}: Kinematic={1}", LogHeader, _kinematic); |
697 | } | 697 | } |
698 | } | 698 | } |
699 | public override float Buoyancy { | 699 | public override float Buoyancy { |
700 | get { return _buoyancy; } | 700 | get { return _buoyancy; } |
701 | set { | 701 | set { |
702 | _buoyancy = value; | 702 | _buoyancy = value; |
703 | PhysicsScene.TaintedObject("BSPrim.setBuoyancy", delegate() | 703 | PhysicsScene.TaintedObject("BSPrim.setBuoyancy", delegate() |
@@ -707,32 +707,32 @@ public sealed class BSPrim : BSPhysObject | |||
707 | float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); | 707 | float grav = PhysicsScene.Params.gravity * (1f - _buoyancy); |
708 | BulletSimAPI.SetGravity2(BSBody.ptr, new OMV.Vector3(0f, 0f, grav)); | 708 | BulletSimAPI.SetGravity2(BSBody.ptr, new OMV.Vector3(0f, 0f, grav)); |
709 | }); | 709 | }); |
710 | } | 710 | } |
711 | } | 711 | } |
712 | 712 | ||
713 | // Used for MoveTo | 713 | // Used for MoveTo |
714 | public override OMV.Vector3 PIDTarget { | 714 | public override OMV.Vector3 PIDTarget { |
715 | set { _PIDTarget = value; } | 715 | set { _PIDTarget = value; } |
716 | } | 716 | } |
717 | public override bool PIDActive { | 717 | public override bool PIDActive { |
718 | set { _usePID = value; } | 718 | set { _usePID = value; } |
719 | } | 719 | } |
720 | public override float PIDTau { | 720 | public override float PIDTau { |
721 | set { _PIDTau = value; } | 721 | set { _PIDTau = value; } |
722 | } | 722 | } |
723 | 723 | ||
724 | // Used for llSetHoverHeight and maybe vehicle height | 724 | // Used for llSetHoverHeight and maybe vehicle height |
725 | // Hover Height will override MoveTo target's Z | 725 | // Hover Height will override MoveTo target's Z |
726 | public override bool PIDHoverActive { | 726 | public override bool PIDHoverActive { |
727 | set { _useHoverPID = value; } | 727 | set { _useHoverPID = value; } |
728 | } | 728 | } |
729 | public override float PIDHoverHeight { | 729 | public override float PIDHoverHeight { |
730 | set { _PIDHoverHeight = value; } | 730 | set { _PIDHoverHeight = value; } |
731 | } | 731 | } |
732 | public override PIDHoverType PIDHoverType { | 732 | public override PIDHoverType PIDHoverType { |
733 | set { _PIDHoverType = value; } | 733 | set { _PIDHoverType = value; } |
734 | } | 734 | } |
735 | public override float PIDHoverTau { | 735 | public override float PIDHoverTau { |
736 | set { _PIDHoverTao = value; } | 736 | set { _PIDHoverTao = value; } |
737 | } | 737 | } |
738 | 738 | ||
@@ -773,11 +773,11 @@ public sealed class BSPrim : BSPhysObject | |||
773 | }); | 773 | }); |
774 | } | 774 | } |
775 | 775 | ||
776 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { | 776 | public override void AddAngularForce(OMV.Vector3 force, bool pushforce) { |
777 | // DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce); | 777 | // DetailLog("{0},BSPrim.AddAngularForce,call,angForce={1},push={2}", LocalID, force, pushforce); |
778 | // m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce); | 778 | // m_log.DebugFormat("{0}: AddAngularForce. f={1}, push={2}", LogHeader, force, pushforce); |
779 | } | 779 | } |
780 | public override void SetMomentum(OMV.Vector3 momentum) { | 780 | public override void SetMomentum(OMV.Vector3 momentum) { |
781 | // DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum); | 781 | // DetailLog("{0},BSPrim.SetMomentum,call,mom={1}", LocalID, momentum); |
782 | } | 782 | } |
783 | #region Mass Calculation | 783 | #region Mass Calculation |
@@ -789,8 +789,8 @@ public sealed class BSPrim : BSPhysObject | |||
789 | 789 | ||
790 | float returnMass = 0; | 790 | float returnMass = 0; |
791 | float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f; | 791 | float hollowAmount = (float)_pbs.ProfileHollow * 2.0e-5f; |
792 | float hollowVolume = hollowAmount * hollowAmount; | 792 | float hollowVolume = hollowAmount * hollowAmount; |
793 | 793 | ||
794 | switch (_pbs.ProfileShape) | 794 | switch (_pbs.ProfileShape) |
795 | { | 795 | { |
796 | case ProfileShape.Square: | 796 | case ProfileShape.Square: |
@@ -826,16 +826,16 @@ public sealed class BSPrim : BSPhysObject | |||
826 | 826 | ||
827 | else if (_pbs.PathCurve == (byte)Extrusion.Curve1) | 827 | else if (_pbs.PathCurve == (byte)Extrusion.Curve1) |
828 | { | 828 | { |
829 | //a tube | 829 | //a tube |
830 | 830 | ||
831 | volume *= 0.78539816339e-2f * (float)(200 - _pbs.PathScaleX); | 831 | volume *= 0.78539816339e-2f * (float)(200 - _pbs.PathScaleX); |
832 | tmp= 1.0f -2.0e-2f * (float)(200 - _pbs.PathScaleY); | 832 | tmp= 1.0f -2.0e-2f * (float)(200 - _pbs.PathScaleY); |
833 | volume -= volume*tmp*tmp; | 833 | volume -= volume*tmp*tmp; |
834 | 834 | ||
835 | if (hollowAmount > 0.0) | 835 | if (hollowAmount > 0.0) |
836 | { | 836 | { |
837 | hollowVolume *= hollowAmount; | 837 | hollowVolume *= hollowAmount; |
838 | 838 | ||
839 | switch (_pbs.HollowShape) | 839 | switch (_pbs.HollowShape) |
840 | { | 840 | { |
841 | case HollowShape.Square: | 841 | case HollowShape.Square: |
@@ -894,7 +894,7 @@ public sealed class BSPrim : BSPhysObject | |||
894 | volume *= 0.61685027506808491367715568749226e-2f * (float)(200 - _pbs.PathScaleX); | 894 | volume *= 0.61685027506808491367715568749226e-2f * (float)(200 - _pbs.PathScaleX); |
895 | tmp = 1.0f - .02f * (float)(200 - _pbs.PathScaleY); | 895 | tmp = 1.0f - .02f * (float)(200 - _pbs.PathScaleY); |
896 | volume *= (1.0f - tmp * tmp); | 896 | volume *= (1.0f - tmp * tmp); |
897 | 897 | ||
898 | if (hollowAmount > 0.0) | 898 | if (hollowAmount > 0.0) |
899 | { | 899 | { |
900 | 900 | ||
@@ -1118,7 +1118,7 @@ public sealed class BSPrim : BSPhysObject | |||
1118 | PhysicsScene.Shapes.GetBodyAndShape(forceRebuild, PhysicsScene.World, this, shapeData, _pbs); | 1118 | PhysicsScene.Shapes.GetBodyAndShape(forceRebuild, PhysicsScene.World, this, shapeData, _pbs); |
1119 | 1119 | ||
1120 | Linkset = Linkset.AddMeToLinkset(this); | 1120 | Linkset = Linkset.AddMeToLinkset(this); |
1121 | 1121 | ||
1122 | // Make sure the properties are set on the new object | 1122 | // Make sure the properties are set on the new object |
1123 | UpdatePhysicalParameters(); | 1123 | UpdatePhysicalParameters(); |
1124 | return; | 1124 | return; |
@@ -1210,7 +1210,7 @@ public sealed class BSPrim : BSPhysObject | |||
1210 | { | 1210 | { |
1211 | // For debugging, we can also report the movement of children | 1211 | // For debugging, we can also report the movement of children |
1212 | DetailLog("{0},BSPrim.UpdateProperties,child,pos={1},orient={2},vel={3},accel={4},rotVel={5}", | 1212 | DetailLog("{0},BSPrim.UpdateProperties,child,pos={1},orient={2},vel={3},accel={4},rotVel={5}", |
1213 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, | 1213 | LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, |
1214 | entprop.Acceleration, entprop.RotationalVelocity); | 1214 | entprop.Acceleration, entprop.RotationalVelocity); |
1215 | } | 1215 | } |
1216 | */ | 1216 | */ |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 44a249c..0cf8c91 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -49,7 +49,7 @@ using OpenMetaverse; | |||
49 | // At the moment, physical and phantom causes object to drop through the terrain | 49 | // At the moment, physical and phantom causes object to drop through the terrain |
50 | // Physical phantom objects and related typing (collision options ) | 50 | // Physical phantom objects and related typing (collision options ) |
51 | // Check out llVolumeDetect. Must do something for that. | 51 | // Check out llVolumeDetect. Must do something for that. |
52 | // Use collision masks for collision with terrain and phantom objects | 52 | // Use collision masks for collision with terrain and phantom objects |
53 | // More efficient memory usage when passing hull information from BSPrim to BulletSim | 53 | // More efficient memory usage when passing hull information from BSPrim to BulletSim |
54 | // Should prim.link() and prim.delink() membership checking happen at taint time? | 54 | // Should prim.link() and prim.delink() membership checking happen at taint time? |
55 | // Mesh sharing. Use meshHash to tell if we already have a hull of that shape and only create once. | 55 | // Mesh sharing. Use meshHash to tell if we already have a hull of that shape and only create once. |
@@ -60,7 +60,7 @@ using OpenMetaverse; | |||
60 | // Add PID movement operations. What does ScenePresence.MoveToTarget do? | 60 | // Add PID movement operations. What does ScenePresence.MoveToTarget do? |
61 | // Check terrain size. 128 or 127? | 61 | // Check terrain size. 128 or 127? |
62 | // Raycast | 62 | // Raycast |
63 | // | 63 | // |
64 | namespace OpenSim.Region.Physics.BulletSPlugin | 64 | namespace OpenSim.Region.Physics.BulletSPlugin |
65 | { | 65 | { |
66 | public class BSScene : PhysicsScene, IPhysicsParameters | 66 | public class BSScene : PhysicsScene, IPhysicsParameters |
@@ -327,7 +327,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
327 | { | 327 | { |
328 | m_log.Debug("[BULLETS UNMANAGED]:" + msg); | 328 | m_log.Debug("[BULLETS UNMANAGED]:" + msg); |
329 | } | 329 | } |
330 | 330 | ||
331 | // Called directly from unmanaged code so don't do much | 331 | // Called directly from unmanaged code so don't do much |
332 | private void BulletLoggerPhysLog(string msg) | 332 | private void BulletLoggerPhysLog(string msg) |
333 | { | 333 | { |
@@ -460,7 +460,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
460 | } | 460 | } |
461 | 461 | ||
462 | // This is a call from the simulator saying that some physical property has been updated. | 462 | // This is a call from the simulator saying that some physical property has been updated. |
463 | // The BulletSim driver senses the changing of relevant properties so this taint | 463 | // The BulletSim driver senses the changing of relevant properties so this taint |
464 | // information call is not needed. | 464 | // information call is not needed. |
465 | public override void AddPhysicsActorTaint(PhysicsActor prim) { } | 465 | public override void AddPhysicsActorTaint(PhysicsActor prim) { } |
466 | 466 | ||
@@ -501,14 +501,14 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
501 | out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr); | 501 | out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr); |
502 | 502 | ||
503 | if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime); | 503 | if (PhysicsLogging.Enabled) simTime = Util.EnvironmentTickCountSubtract(beforeTime); |
504 | DetailLog("{0},Simulate,call, nTaints={1}, simTime={2}, substeps={3}, updates={4}, colliders={5}", | 504 | DetailLog("{0},Simulate,call, nTaints={1}, simTime={2}, substeps={3}, updates={4}, colliders={5}", |
505 | DetailLogZero, numTaints, simTime, numSubSteps, updatedEntityCount, collidersCount); | 505 | DetailLogZero, numTaints, simTime, numSubSteps, updatedEntityCount, collidersCount); |
506 | } | 506 | } |
507 | catch (Exception e) | 507 | catch (Exception e) |
508 | { | 508 | { |
509 | m_log.WarnFormat("{0},PhysicsStep Exception: nTaints={1}, substeps={2}, updates={3}, colliders={4}, e={5}", | 509 | m_log.WarnFormat("{0},PhysicsStep Exception: nTaints={1}, substeps={2}, updates={3}, colliders={4}, e={5}", |
510 | LogHeader, numTaints, numSubSteps, updatedEntityCount, collidersCount, e); | 510 | LogHeader, numTaints, numSubSteps, updatedEntityCount, collidersCount, e); |
511 | DetailLog("{0},PhysicsStepException,call, nTaints={1}, substeps={2}, updates={3}, colliders={4}", | 511 | DetailLog("{0},PhysicsStepException,call, nTaints={1}, substeps={2}, updates={3}, colliders={4}", |
512 | DetailLogZero, numTaints, numSubSteps, updatedEntityCount, collidersCount); | 512 | DetailLogZero, numTaints, numSubSteps, updatedEntityCount, collidersCount); |
513 | updatedEntityCount = 0; | 513 | updatedEntityCount = 0; |
514 | collidersCount = 0; | 514 | collidersCount = 0; |
@@ -535,7 +535,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
535 | } | 535 | } |
536 | } | 536 | } |
537 | 537 | ||
538 | // This is a kludge to get avatar movement updates. | 538 | // This is a kludge to get avatar movement updates. |
539 | // ODE sends collisions for avatars even if there are have been no collisions. This updates | 539 | // ODE sends collisions for avatars even if there are have been no collisions. This updates |
540 | // avatar animations and stuff. | 540 | // avatar animations and stuff. |
541 | // If you fix avatar animation updates, remove this overhead and let normal collision processing happen. | 541 | // If you fix avatar animation updates, remove this overhead and let normal collision processing happen. |
@@ -634,7 +634,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
634 | TerrainManager.SetTerrain(heightMap); | 634 | TerrainManager.SetTerrain(heightMap); |
635 | } | 635 | } |
636 | 636 | ||
637 | public override void SetWaterLevel(float baseheight) | 637 | public override void SetWaterLevel(float baseheight) |
638 | { | 638 | { |
639 | m_waterLevel = baseheight; | 639 | m_waterLevel = baseheight; |
640 | } | 640 | } |
@@ -644,7 +644,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
644 | return m_waterLevel; | 644 | return m_waterLevel; |
645 | } | 645 | } |
646 | 646 | ||
647 | public override void DeleteTerrain() | 647 | public override void DeleteTerrain() |
648 | { | 648 | { |
649 | // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); | 649 | // m_log.DebugFormat("{0}: DeleteTerrain()", LogHeader); |
650 | } | 650 | } |
@@ -806,7 +806,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
806 | // getters and setters. | 806 | // getters and setters. |
807 | // It is easiest to find an existing definition and copy it. | 807 | // It is easiest to find an existing definition and copy it. |
808 | // Parameter values are floats. Booleans are converted to a floating value. | 808 | // Parameter values are floats. Booleans are converted to a floating value. |
809 | // | 809 | // |
810 | // A ParameterDefn() takes the following parameters: | 810 | // A ParameterDefn() takes the following parameters: |
811 | // -- the text name of the parameter. This is used for console input and ini file. | 811 | // -- the text name of the parameter. This is used for console input and ini file. |
812 | // -- a short text description of the parameter. This shows up in the console listing. | 812 | // -- a short text description of the parameter. This shows up in the console listing. |
@@ -1228,7 +1228,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters | |||
1228 | } | 1228 | } |
1229 | }); | 1229 | }); |
1230 | break; | 1230 | break; |
1231 | default: | 1231 | default: |
1232 | // setting only one localID | 1232 | // setting only one localID |
1233 | TaintedUpdateParameter(parm, localID, val); | 1233 | TaintedUpdateParameter(parm, localID, val); |
1234 | break; | 1234 | break; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs index 72c6df5..b428ba3 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs | |||
@@ -102,7 +102,7 @@ public class BSShapeCollection : IDisposable | |||
102 | bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, prim.BSShape, shapeData); | 102 | bool newBody = CreateBody((newGeom || forceRebuild), prim, PhysicsScene.World, prim.BSShape, shapeData); |
103 | ret = newGeom || newBody; | 103 | ret = newGeom || newBody; |
104 | } | 104 | } |
105 | DetailLog("{0},BSShapeCollection.GetBodyAndShape,force={1},ret={2},body={3},shape={4}", | 105 | DetailLog("{0},BSShapeCollection.GetBodyAndShape,force={1},ret={2},body={3},shape={4}", |
106 | prim.LocalID, forceRebuild, ret, prim.BSBody, prim.BSShape); | 106 | prim.LocalID, forceRebuild, ret, prim.BSBody, prim.BSShape); |
107 | 107 | ||
108 | return ret; | 108 | return ret; |
@@ -149,14 +149,14 @@ public class BSShapeCollection : IDisposable | |||
149 | bodyDesc.lastReferenced = System.DateTime.Now; | 149 | bodyDesc.lastReferenced = System.DateTime.Now; |
150 | Bodies[shape.ID] = bodyDesc; | 150 | Bodies[shape.ID] = bodyDesc; |
151 | DetailLog("{0},BSShapeCollection.DereferenceBody,ref={1}", shape.ID, bodyDesc.referenceCount); | 151 | DetailLog("{0},BSShapeCollection.DereferenceBody,ref={1}", shape.ID, bodyDesc.referenceCount); |
152 | 152 | ||
153 | // If body is no longer being used, free it -- bodies are never shared. | 153 | // If body is no longer being used, free it -- bodies are never shared. |
154 | if (bodyDesc.referenceCount == 0) | 154 | if (bodyDesc.referenceCount == 0) |
155 | { | 155 | { |
156 | Bodies.Remove(shape.ID); | 156 | Bodies.Remove(shape.ID); |
157 | BSScene.TaintCallback removeOperation = delegate() | 157 | BSScene.TaintCallback removeOperation = delegate() |
158 | { | 158 | { |
159 | DetailLog("{0},BSShapeCollection.DereferenceBody,DestroyingBody. ptr={1}", | 159 | DetailLog("{0},BSShapeCollection.DereferenceBody,DestroyingBody. ptr={1}", |
160 | shape.ID, shape.ptr.ToString("X")); | 160 | shape.ID, shape.ptr.ToString("X")); |
161 | // Zero any reference to the shape so it is not freed when the body is deleted. | 161 | // Zero any reference to the shape so it is not freed when the body is deleted. |
162 | BulletSimAPI.SetCollisionShape2(PhysicsScene.World.ptr, shape.ptr, IntPtr.Zero); | 162 | BulletSimAPI.SetCollisionShape2(PhysicsScene.World.ptr, shape.ptr, IntPtr.Zero); |
@@ -344,28 +344,28 @@ public class BSShapeCollection : IDisposable | |||
344 | if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) | 344 | if (pbs.ProfileShape == ProfileShape.HalfCircle && pbs.PathCurve == (byte)Extrusion.Curve1) |
345 | { | 345 | { |
346 | haveShape = true; | 346 | haveShape = true; |
347 | if (forceRebuild | 347 | if (forceRebuild |
348 | || prim.Scale != shapeData.Size | 348 | || prim.Scale != shapeData.Size |
349 | || prim.BSShape.type != ShapeData.PhysicsShapeType.SHAPE_SPHERE | 349 | || prim.BSShape.type != ShapeData.PhysicsShapeType.SHAPE_SPHERE |
350 | ) | 350 | ) |
351 | { | 351 | { |
352 | ret = GetReferenceToNativeShape(prim, shapeData, | 352 | ret = GetReferenceToNativeShape(prim, shapeData, |
353 | ShapeData.PhysicsShapeType.SHAPE_SPHERE, ShapeData.FixedShapeKey.KEY_SPHERE); | 353 | ShapeData.PhysicsShapeType.SHAPE_SPHERE, ShapeData.FixedShapeKey.KEY_SPHERE); |
354 | DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}", | 354 | DetailLog("{0},BSShapeCollection.CreateGeom,sphere,force={1},shape={2}", |
355 | prim.LocalID, forceRebuild, prim.BSShape); | 355 | prim.LocalID, forceRebuild, prim.BSShape); |
356 | } | 356 | } |
357 | } | 357 | } |
358 | else | 358 | else |
359 | { | 359 | { |
360 | haveShape = true; | 360 | haveShape = true; |
361 | if (forceRebuild | 361 | if (forceRebuild |
362 | || prim.Scale != shapeData.Size | 362 | || prim.Scale != shapeData.Size |
363 | || prim.BSShape.type != ShapeData.PhysicsShapeType.SHAPE_BOX | 363 | || prim.BSShape.type != ShapeData.PhysicsShapeType.SHAPE_BOX |
364 | ) | 364 | ) |
365 | { | 365 | { |
366 | ret = GetReferenceToNativeShape( | 366 | ret = GetReferenceToNativeShape( |
367 | prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_BOX, ShapeData.FixedShapeKey.KEY_BOX); | 367 | prim, shapeData, ShapeData.PhysicsShapeType.SHAPE_BOX, ShapeData.FixedShapeKey.KEY_BOX); |
368 | DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}", | 368 | DetailLog("{0},BSShapeCollection.CreateGeom,box,force={1},shape={2}", |
369 | prim.LocalID, forceRebuild, prim.BSShape); | 369 | prim.LocalID, forceRebuild, prim.BSShape); |
370 | } | 370 | } |
371 | } | 371 | } |
@@ -379,13 +379,13 @@ public class BSShapeCollection : IDisposable | |||
379 | { | 379 | { |
380 | // Update prim.BSShape to reference a hull of this shape. | 380 | // Update prim.BSShape to reference a hull of this shape. |
381 | ret = GetReferenceToHull(prim, shapeData, pbs); | 381 | ret = GetReferenceToHull(prim, shapeData, pbs); |
382 | DetailLog("{0},BSShapeCollection.CreateGeom,hull,shape={1},key={2}", | 382 | DetailLog("{0},BSShapeCollection.CreateGeom,hull,shape={1},key={2}", |
383 | shapeData.ID, prim.BSShape, prim.BSShape.shapeKey.ToString("X")); | 383 | shapeData.ID, prim.BSShape, prim.BSShape.shapeKey.ToString("X")); |
384 | } | 384 | } |
385 | else | 385 | else |
386 | { | 386 | { |
387 | ret = GetReferenceToMesh(prim, shapeData, pbs); | 387 | ret = GetReferenceToMesh(prim, shapeData, pbs); |
388 | DetailLog("{0},BSShapeCollection.CreateGeom,mesh,shape={1},key={2}", | 388 | DetailLog("{0},BSShapeCollection.CreateGeom,mesh,shape={1},key={2}", |
389 | shapeData.ID, prim.BSShape, prim.BSShape.shapeKey.ToString("X")); | 389 | shapeData.ID, prim.BSShape, prim.BSShape.shapeKey.ToString("X")); |
390 | } | 390 | } |
391 | } | 391 | } |
@@ -393,7 +393,7 @@ public class BSShapeCollection : IDisposable | |||
393 | } | 393 | } |
394 | 394 | ||
395 | // Creates a native shape and assignes it to prim.BSShape | 395 | // Creates a native shape and assignes it to prim.BSShape |
396 | private bool GetReferenceToNativeShape( BSPrim prim, ShapeData shapeData, | 396 | private bool GetReferenceToNativeShape( BSPrim prim, ShapeData shapeData, |
397 | ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey) | 397 | ShapeData.PhysicsShapeType shapeType, ShapeData.FixedShapeKey shapeKey) |
398 | { | 398 | { |
399 | BulletShape newShape; | 399 | BulletShape newShape; |
@@ -432,7 +432,7 @@ public class BSShapeCollection : IDisposable | |||
432 | // if this new shape is the same as last time, don't recreate the mesh | 432 | // if this new shape is the same as last time, don't recreate the mesh |
433 | if (prim.BSShape.shapeKey == newMeshKey) return false; | 433 | if (prim.BSShape.shapeKey == newMeshKey) return false; |
434 | 434 | ||
435 | DetailLog("{0},BSShapeCollection.CreateGeomMesh,create,oldKey={1},newKey={2}", | 435 | DetailLog("{0},BSShapeCollection.CreateGeomMesh,create,oldKey={1},newKey={2}", |
436 | prim.LocalID, prim.BSShape.shapeKey.ToString("X"), newMeshKey.ToString("X")); | 436 | prim.LocalID, prim.BSShape.shapeKey.ToString("X"), newMeshKey.ToString("X")); |
437 | 437 | ||
438 | // Since we're recreating new, get rid of the reference to the previous shape | 438 | // Since we're recreating new, get rid of the reference to the previous shape |
@@ -476,10 +476,10 @@ public class BSShapeCollection : IDisposable | |||
476 | verticesAsFloats[vi++] = vv.Z; | 476 | verticesAsFloats[vi++] = vv.Z; |
477 | } | 477 | } |
478 | 478 | ||
479 | // m_log.DebugFormat("{0}: CreateGeomMesh: calling CreateMesh. lid={1}, key={2}, indices={3}, vertices={4}", | 479 | // m_log.DebugFormat("{0}: CreateGeomMesh: calling CreateMesh. lid={1}, key={2}, indices={3}, vertices={4}", |
480 | // LogHeader, prim.LocalID, newMeshKey, indices.Length, vertices.Count); | 480 | // LogHeader, prim.LocalID, newMeshKey, indices.Length, vertices.Count); |
481 | 481 | ||
482 | meshPtr = BulletSimAPI.CreateMeshShape2(PhysicsScene.World.ptr, | 482 | meshPtr = BulletSimAPI.CreateMeshShape2(PhysicsScene.World.ptr, |
483 | indices.GetLength(0), indices, vertices.Count, verticesAsFloats); | 483 | indices.GetLength(0), indices, vertices.Count, verticesAsFloats); |
484 | } | 484 | } |
485 | BulletShape newShape = new BulletShape(meshPtr, ShapeData.PhysicsShapeType.SHAPE_MESH); | 485 | BulletShape newShape = new BulletShape(meshPtr, ShapeData.PhysicsShapeType.SHAPE_MESH); |
@@ -501,14 +501,14 @@ public class BSShapeCollection : IDisposable | |||
501 | if (newHullKey == prim.BSShape.shapeKey && prim.BSShape.type == ShapeData.PhysicsShapeType.SHAPE_HULL) | 501 | if (newHullKey == prim.BSShape.shapeKey && prim.BSShape.type == ShapeData.PhysicsShapeType.SHAPE_HULL) |
502 | return false; | 502 | return false; |
503 | 503 | ||
504 | DetailLog("{0},BSShapeCollection.CreateGeomHull,create,oldKey={1},newKey={2}", | 504 | DetailLog("{0},BSShapeCollection.CreateGeomHull,create,oldKey={1},newKey={2}", |
505 | prim.LocalID, prim.BSShape.shapeKey.ToString("X"), newHullKey.ToString("X")); | 505 | prim.LocalID, prim.BSShape.shapeKey.ToString("X"), newHullKey.ToString("X")); |
506 | 506 | ||
507 | // Remove usage of the previous shape. Also removes reference to underlying mesh if it is a hull. | 507 | // Remove usage of the previous shape. Also removes reference to underlying mesh if it is a hull. |
508 | DereferenceShape(prim.BSShape, true); | 508 | DereferenceShape(prim.BSShape, true); |
509 | 509 | ||
510 | newShape = CreatePhysicalHull(prim.PhysObjectName, newHullKey, pbs, shapeData.Size, lod); | 510 | newShape = CreatePhysicalHull(prim.PhysObjectName, newHullKey, pbs, shapeData.Size, lod); |
511 | 511 | ||
512 | ReferenceShape(newShape); | 512 | ReferenceShape(newShape); |
513 | 513 | ||
514 | // hulls are already scaled by the meshmerizer | 514 | // hulls are already scaled by the meshmerizer |
@@ -559,7 +559,7 @@ public class BSShapeCollection : IDisposable | |||
559 | convexBuilder.process(dcomp); | 559 | convexBuilder.process(dcomp); |
560 | 560 | ||
561 | // Convert the vertices and indices for passing to unmanaged. | 561 | // Convert the vertices and indices for passing to unmanaged. |
562 | // The hull information is passed as a large floating point array. | 562 | // The hull information is passed as a large floating point array. |
563 | // The format is: | 563 | // The format is: |
564 | // convHulls[0] = number of hulls | 564 | // convHulls[0] = number of hulls |
565 | // convHulls[1] = number of vertices in first hull | 565 | // convHulls[1] = number of vertices in first hull |
@@ -635,11 +635,11 @@ public class BSShapeCollection : IDisposable | |||
635 | { | 635 | { |
636 | // level of detail based on size and type of the object | 636 | // level of detail based on size and type of the object |
637 | float lod = PhysicsScene.MeshLOD; | 637 | float lod = PhysicsScene.MeshLOD; |
638 | if (pbs.SculptEntry) | 638 | if (pbs.SculptEntry) |
639 | lod = PhysicsScene.SculptLOD; | 639 | lod = PhysicsScene.SculptLOD; |
640 | 640 | ||
641 | float maxAxis = Math.Max(shapeData.Size.X, Math.Max(shapeData.Size.Y, shapeData.Size.Z)); | 641 | float maxAxis = Math.Max(shapeData.Size.X, Math.Max(shapeData.Size.Y, shapeData.Size.Z)); |
642 | if (maxAxis > PhysicsScene.MeshMegaPrimThreshold) | 642 | if (maxAxis > PhysicsScene.MeshMegaPrimThreshold) |
643 | lod = PhysicsScene.MeshMegaPrimLOD; | 643 | lod = PhysicsScene.MeshMegaPrimLOD; |
644 | 644 | ||
645 | retLod = lod; | 645 | retLod = lod; |
@@ -685,13 +685,13 @@ public class BSShapeCollection : IDisposable | |||
685 | IntPtr bodyPtr = IntPtr.Zero; | 685 | IntPtr bodyPtr = IntPtr.Zero; |
686 | if (prim.IsSolid) | 686 | if (prim.IsSolid) |
687 | { | 687 | { |
688 | bodyPtr = BulletSimAPI.CreateBodyFromShape2(sim.ptr, shape.ptr, | 688 | bodyPtr = BulletSimAPI.CreateBodyFromShape2(sim.ptr, shape.ptr, |
689 | shapeData.ID, shapeData.Position, shapeData.Rotation); | 689 | shapeData.ID, shapeData.Position, shapeData.Rotation); |
690 | // DetailLog("{0},BSShapeCollection.CreateBody,mesh,ptr={1}", prim.LocalID, bodyPtr.ToString("X")); | 690 | // DetailLog("{0},BSShapeCollection.CreateBody,mesh,ptr={1}", prim.LocalID, bodyPtr.ToString("X")); |
691 | } | 691 | } |
692 | else | 692 | else |
693 | { | 693 | { |
694 | bodyPtr = BulletSimAPI.CreateGhostFromShape2(sim.ptr, shape.ptr, | 694 | bodyPtr = BulletSimAPI.CreateGhostFromShape2(sim.ptr, shape.ptr, |
695 | shapeData.ID, shapeData.Position, shapeData.Rotation); | 695 | shapeData.ID, shapeData.Position, shapeData.Rotation); |
696 | // DetailLog("{0},BSShapeCollection.CreateBody,ghost,ptr={1}", prim.LocalID, bodyPtr.ToString("X")); | 696 | // DetailLog("{0},BSShapeCollection.CreateBody,ghost,ptr={1}", prim.LocalID, bodyPtr.ToString("X")); |
697 | } | 697 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs index 269c3d5..70aa429 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSTerrainManager.cs | |||
@@ -64,7 +64,7 @@ public class BSTerrainManager | |||
64 | 64 | ||
65 | // The ground plane created to keep thing from falling to infinity. | 65 | // The ground plane created to keep thing from falling to infinity. |
66 | private BulletBody m_groundPlane; | 66 | private BulletBody m_groundPlane; |
67 | 67 | ||
68 | // If doing mega-regions, if we're region zero we will be managing multiple | 68 | // If doing mega-regions, if we're region zero we will be managing multiple |
69 | // region terrains since region zero does the physics for the whole mega-region. | 69 | // region terrains since region zero does the physics for the whole mega-region. |
70 | private Dictionary<Vector2, BulletHeightMapInfo> m_heightMaps; | 70 | private Dictionary<Vector2, BulletHeightMapInfo> m_heightMaps; |
@@ -110,8 +110,8 @@ public class BSTerrainManager | |||
110 | BulletShape groundPlaneShape = new BulletShape( | 110 | BulletShape groundPlaneShape = new BulletShape( |
111 | BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN), | 111 | BulletSimAPI.CreateGroundPlaneShape2(BSScene.GROUNDPLANE_ID, 1f, TERRAIN_COLLISION_MARGIN), |
112 | ShapeData.PhysicsShapeType.SHAPE_GROUNDPLANE); | 112 | ShapeData.PhysicsShapeType.SHAPE_GROUNDPLANE); |
113 | m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, | 113 | m_groundPlane = new BulletBody(BSScene.GROUNDPLANE_ID, |
114 | BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, | 114 | BulletSimAPI.CreateBodyWithDefaultMotionState2(groundPlaneShape.ptr, BSScene.GROUNDPLANE_ID, |
115 | Vector3.Zero, Quaternion.Identity)); | 115 | Vector3.Zero, Quaternion.Identity)); |
116 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr); | 116 | BulletSimAPI.AddObjectToWorld2(PhysicsScene.World.ptr, m_groundPlane.ptr); |
117 | // Everything collides with the ground plane. | 117 | // Everything collides with the ground plane. |
@@ -182,7 +182,7 @@ public class BSTerrainManager | |||
182 | // If not doing the mega-prim thing, just change the terrain | 182 | // If not doing the mega-prim thing, just change the terrain |
183 | DetailLog("{0},SetTerrain.Existing", BSScene.DetailLogZero); | 183 | DetailLog("{0},SetTerrain.Existing", BSScene.DetailLogZero); |
184 | 184 | ||
185 | UpdateOrCreateTerrain(BSScene.TERRAIN_ID, localHeightMap, | 185 | UpdateOrCreateTerrain(BSScene.TERRAIN_ID, localHeightMap, |
186 | m_worldOffset, m_worldOffset + DefaultRegionSize, true); | 186 | m_worldOffset, m_worldOffset + DefaultRegionSize, true); |
187 | } | 187 | } |
188 | }); | 188 | }); |
@@ -234,7 +234,7 @@ public class BSTerrainManager | |||
234 | mapInfo.maxZ = maxZ; | 234 | mapInfo.maxZ = maxZ; |
235 | mapInfo.sizeX = maxCoords.X - minCoords.X; | 235 | mapInfo.sizeX = maxCoords.X - minCoords.X; |
236 | mapInfo.sizeY = maxCoords.Y - minCoords.Y; | 236 | mapInfo.sizeY = maxCoords.Y - minCoords.Y; |
237 | DetailLog("{0},UpdateOrCreateTerrain:UpdateExisting,call,terrainBase={1},minC={2}, maxC={3}, szX={4}, szY={5}", | 237 | DetailLog("{0},UpdateOrCreateTerrain:UpdateExisting,call,terrainBase={1},minC={2}, maxC={3}, szX={4}, szY={5}", |
238 | BSScene.DetailLogZero, terrainRegionBase, mapInfo.minCoords, mapInfo.maxCoords, mapInfo.sizeX, mapInfo.sizeY); | 238 | BSScene.DetailLogZero, terrainRegionBase, mapInfo.minCoords, mapInfo.maxCoords, mapInfo.sizeX, mapInfo.sizeY); |
239 | 239 | ||
240 | BSScene.TaintCallback rebuildOperation = delegate() | 240 | BSScene.TaintCallback rebuildOperation = delegate() |
@@ -255,7 +255,7 @@ public class BSTerrainManager | |||
255 | if (mapInfo.terrainBody.ptr != IntPtr.Zero) | 255 | if (mapInfo.terrainBody.ptr != IntPtr.Zero) |
256 | { | 256 | { |
257 | // Updating an existing terrain. | 257 | // Updating an existing terrain. |
258 | DetailLog("{0},UpdateOrCreateTerrain:UpdateExisting,taint,terrainBase={1},minC={2}, maxC={3}, szX={4}, szY={5}", | 258 | DetailLog("{0},UpdateOrCreateTerrain:UpdateExisting,taint,terrainBase={1},minC={2}, maxC={3}, szX={4}, szY={5}", |
259 | BSScene.DetailLogZero, terrainRegionBase, mapInfo.minCoords, mapInfo.maxCoords, mapInfo.sizeX, mapInfo.sizeY); | 259 | BSScene.DetailLogZero, terrainRegionBase, mapInfo.minCoords, mapInfo.maxCoords, mapInfo.sizeX, mapInfo.sizeY); |
260 | 260 | ||
261 | // Remove from the dynamics world because we're going to mangle this object | 261 | // Remove from the dynamics world because we're going to mangle this object |
@@ -289,7 +289,7 @@ public class BSTerrainManager | |||
289 | // else | 289 | // else |
290 | { | 290 | { |
291 | // Creating a new terrain. | 291 | // Creating a new terrain. |
292 | DetailLog("{0},UpdateOrCreateTerrain:CreateNewTerrain,taint,baseX={1},baseY={2},minZ={3},maxZ={4}", | 292 | DetailLog("{0},UpdateOrCreateTerrain:CreateNewTerrain,taint,baseX={1},baseY={2},minZ={3},maxZ={4}", |
293 | BSScene.DetailLogZero, mapInfo.minCoords.X, mapInfo.minCoords.Y, minZ, maxZ); | 293 | BSScene.DetailLogZero, mapInfo.minCoords.X, mapInfo.minCoords.Y, minZ, maxZ); |
294 | 294 | ||
295 | mapInfo.ID = id; | 295 | mapInfo.ID = id; |
@@ -306,9 +306,9 @@ public class BSTerrainManager | |||
306 | mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(mapInfo.Ptr), | 306 | mapInfo.terrainShape = new BulletShape(BulletSimAPI.CreateTerrainShape2(mapInfo.Ptr), |
307 | ShapeData.PhysicsShapeType.SHAPE_TERRAIN); | 307 | ShapeData.PhysicsShapeType.SHAPE_TERRAIN); |
308 | 308 | ||
309 | mapInfo.terrainBody = new BulletBody(mapInfo.ID, | 309 | mapInfo.terrainBody = new BulletBody(mapInfo.ID, |
310 | BulletSimAPI.CreateBodyWithDefaultMotionState2(mapInfo.terrainShape.ptr, | 310 | BulletSimAPI.CreateBodyWithDefaultMotionState2(mapInfo.terrainShape.ptr, |
311 | id, centerPos, Quaternion.Identity)); | 311 | id, centerPos, Quaternion.Identity)); |
312 | } | 312 | } |
313 | 313 | ||
314 | // Make sure the entry is in the heightmap table | 314 | // Make sure the entry is in the heightmap table |
@@ -329,7 +329,7 @@ public class BSTerrainManager | |||
329 | // redo its bounding box now that it is in the world | 329 | // redo its bounding box now that it is in the world |
330 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, mapInfo.terrainBody.ptr); | 330 | BulletSimAPI.UpdateSingleAabb2(PhysicsScene.World.ptr, mapInfo.terrainBody.ptr); |
331 | 331 | ||
332 | BulletSimAPI.SetCollisionFilterMask2(mapInfo.terrainBody.ptr, | 332 | BulletSimAPI.SetCollisionFilterMask2(mapInfo.terrainBody.ptr, |
333 | (uint)CollisionFilterGroups.TerrainFilter, | 333 | (uint)CollisionFilterGroups.TerrainFilter, |
334 | (uint)CollisionFilterGroups.TerrainMask); | 334 | (uint)CollisionFilterGroups.TerrainMask); |
335 | 335 | ||
@@ -361,7 +361,7 @@ public class BSTerrainManager | |||
361 | Vector3 minCoordsX = minCoords; | 361 | Vector3 minCoordsX = minCoords; |
362 | Vector3 maxCoordsX = maxCoords; | 362 | Vector3 maxCoordsX = maxCoords; |
363 | 363 | ||
364 | DetailLog("{0},UpdateOrCreateTerrain:NewTerrain,call,id={1}, minC={2}, maxC={3}", | 364 | DetailLog("{0},UpdateOrCreateTerrain:NewTerrain,call,id={1}, minC={2}, maxC={3}", |
365 | BSScene.DetailLogZero, newTerrainID, minCoords, minCoords); | 365 | BSScene.DetailLogZero, newTerrainID, minCoords, minCoords); |
366 | 366 | ||
367 | // Code that must happen at taint-time | 367 | // Code that must happen at taint-time |
@@ -370,7 +370,7 @@ public class BSTerrainManager | |||
370 | DetailLog("{0},UpdateOrCreateTerrain:NewTerrain,taint,baseX={1},baseY={2}", BSScene.DetailLogZero, minCoords.X, minCoords.Y); | 370 | DetailLog("{0},UpdateOrCreateTerrain:NewTerrain,taint,baseX={1},baseY={2}", BSScene.DetailLogZero, minCoords.X, minCoords.Y); |
371 | // Create a new mapInfo that will be filled with the new info | 371 | // Create a new mapInfo that will be filled with the new info |
372 | mapInfo = new BulletHeightMapInfo(id, heightMapX, | 372 | mapInfo = new BulletHeightMapInfo(id, heightMapX, |
373 | BulletSimAPI.CreateHeightMapInfo2(PhysicsScene.World.ptr, newTerrainID, | 373 | BulletSimAPI.CreateHeightMapInfo2(PhysicsScene.World.ptr, newTerrainID, |
374 | minCoordsX, maxCoordsX, heightMapX, TERRAIN_COLLISION_MARGIN)); | 374 | minCoordsX, maxCoordsX, heightMapX, TERRAIN_COLLISION_MARGIN)); |
375 | // Put the unfilled heightmap info into the collection of same | 375 | // Put the unfilled heightmap info into the collection of same |
376 | m_heightMaps.Add(terrainRegionBase, mapInfo); | 376 | m_heightMaps.Add(terrainRegionBase, mapInfo); |
@@ -454,7 +454,7 @@ public class BSTerrainManager | |||
454 | { | 454 | { |
455 | return true; | 455 | return true; |
456 | } | 456 | } |
457 | 457 | ||
458 | // This routine is called two ways: | 458 | // This routine is called two ways: |
459 | // One with 'offset' and 'pScene' zero and null but 'extents' giving the maximum | 459 | // One with 'offset' and 'pScene' zero and null but 'extents' giving the maximum |
460 | // extent of the combined regions. This is to inform the parent of the size | 460 | // extent of the combined regions. This is to inform the parent of the size |
@@ -469,11 +469,11 @@ public class BSTerrainManager | |||
469 | MegaRegionParentPhysicsScene = pScene; | 469 | MegaRegionParentPhysicsScene = pScene; |
470 | if (pScene != null) | 470 | if (pScene != null) |
471 | { | 471 | { |
472 | // We are a child. | 472 | // We are a child. |
473 | // We want m_worldMax to be the highest coordinate of our piece of terrain. | 473 | // We want m_worldMax to be the highest coordinate of our piece of terrain. |
474 | m_worldMax = offset + DefaultRegionSize; | 474 | m_worldMax = offset + DefaultRegionSize; |
475 | } | 475 | } |
476 | DetailLog("{0},BSTerrainManager.Combine,offset={1},extents={2},wOffset={3},wMax={4}", | 476 | DetailLog("{0},BSTerrainManager.Combine,offset={1},extents={2},wOffset={3},wMax={4}", |
477 | BSScene.DetailLogZero, offset, extents, m_worldOffset, m_worldMax); | 477 | BSScene.DetailLogZero, offset, extents, m_worldOffset, m_worldMax); |
478 | } | 478 | } |
479 | 479 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs index 2d65a35..544c53d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimAPI.cs | |||
@@ -41,8 +41,8 @@ public struct BulletSim | |||
41 | public BulletSim(uint worldId, BSScene bss, IntPtr xx) | 41 | public BulletSim(uint worldId, BSScene bss, IntPtr xx) |
42 | { | 42 | { |
43 | ptr = xx; | 43 | ptr = xx; |
44 | worldID = worldId; | 44 | worldID = worldId; |
45 | scene = bss; | 45 | scene = bss; |
46 | } | 46 | } |
47 | public IntPtr ptr; | 47 | public IntPtr ptr; |
48 | public uint worldID; | 48 | public uint worldID; |