diff options
author | Jeff Ames | 2008-05-16 01:22:11 +0000 |
---|---|---|
committer | Jeff Ames | 2008-05-16 01:22:11 +0000 |
commit | 65c5efe43b68700bad94076d4cd421160203c5de (patch) | |
tree | 589b56649ed02f4942671fd6e51c6dc43f682e0d /OpenSim/Region/Physics/OdePlugin | |
parent | Thank you very much, mjm for : (diff) | |
download | opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.zip opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.gz opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.bz2 opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.xz |
Formatting cleanup.
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 62 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 226 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 208 |
3 files changed, 212 insertions, 284 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 4165484..5024b5d 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -36,7 +36,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
36 | /// <summary> | 36 | /// <summary> |
37 | /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. | 37 | /// Various properties that ODE uses for AMotors but isn't exposed in ODE.NET so we must define them ourselves. |
38 | /// </summary> | 38 | /// </summary> |
39 | 39 | ||
40 | public enum dParam : int | 40 | public enum dParam : int |
41 | { | 41 | { |
42 | LowStop = 0, | 42 | LowStop = 0, |
@@ -106,7 +106,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
106 | private CollisionCategories m_collisionFlags = (CollisionCategories.Geom | 106 | private CollisionCategories m_collisionFlags = (CollisionCategories.Geom |
107 | | CollisionCategories.Space | 107 | | CollisionCategories.Space |
108 | | CollisionCategories.Body | 108 | | CollisionCategories.Body |
109 | | CollisionCategories.Character | 109 | | CollisionCategories.Character |
110 | | CollisionCategories.Land); | 110 | | CollisionCategories.Land); |
111 | public IntPtr Body; | 111 | public IntPtr Body; |
112 | private OdeScene _parent_scene; | 112 | private OdeScene _parent_scene; |
@@ -145,7 +145,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
145 | { | 145 | { |
146 | m_colliderarr[i] = false; | 146 | m_colliderarr[i] = false; |
147 | } | 147 | } |
148 | CAPSULE_LENGTH = (size.Z - ((size.Z * height_fudge_factor))); | 148 | CAPSULE_LENGTH = (size.Z - ((size.Z * height_fudge_factor))); |
149 | 149 | ||
150 | lock (OdeScene.OdeLock) | 150 | lock (OdeScene.OdeLock) |
151 | { | 151 | { |
@@ -338,7 +338,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
338 | } | 338 | } |
339 | 339 | ||
340 | /// <summary> | 340 | /// <summary> |
341 | /// turn the PID controller on or off. | 341 | /// turn the PID controller on or off. |
342 | /// The PID Controller will turn on all by itself in many situations | 342 | /// The PID Controller will turn on all by itself in many situations |
343 | /// </summary> | 343 | /// </summary> |
344 | /// <param name="status"></param> | 344 | /// <param name="status"></param> |
@@ -354,7 +354,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
354 | 354 | ||
355 | /// <summary> | 355 | /// <summary> |
356 | /// This 'puts' an avatar somewhere in the physics space. | 356 | /// This 'puts' an avatar somewhere in the physics space. |
357 | /// Not really a good choice unless you 'know' it's a good | 357 | /// Not really a good choice unless you 'know' it's a good |
358 | /// spot otherwise you're likely to orbit the avatar. | 358 | /// spot otherwise you're likely to orbit the avatar. |
359 | /// </summary> | 359 | /// </summary> |
360 | public override PhysicsVector Position | 360 | public override PhysicsVector Position |
@@ -389,7 +389,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
389 | lock (OdeScene.OdeLock) | 389 | lock (OdeScene.OdeLock) |
390 | { | 390 | { |
391 | d.JointDestroy(Amotor); | 391 | d.JointDestroy(Amotor); |
392 | 392 | ||
393 | PhysicsVector SetSize = value; | 393 | PhysicsVector SetSize = value; |
394 | float prevCapsule = CAPSULE_LENGTH; | 394 | float prevCapsule = CAPSULE_LENGTH; |
395 | float capsuleradius = CAPSULE_RADIUS; | 395 | float capsuleradius = CAPSULE_RADIUS; |
@@ -405,7 +405,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
405 | AvatarGeomAndBodyCreation(_position.X, _position.Y, | 405 | AvatarGeomAndBodyCreation(_position.X, _position.Y, |
406 | _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); | 406 | _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); |
407 | Velocity = new PhysicsVector(0f, 0f, 0f); | 407 | Velocity = new PhysicsVector(0f, 0f, 0f); |
408 | 408 | ||
409 | } | 409 | } |
410 | _parent_scene.geom_name_map[Shell] = m_name; | 410 | _parent_scene.geom_name_map[Shell] = m_name; |
411 | _parent_scene.actor_name_map[Shell] = (PhysicsActor) this; | 411 | _parent_scene.actor_name_map[Shell] = (PhysicsActor) this; |
@@ -423,7 +423,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
423 | int dAMotorEuler = 1; | 423 | int dAMotorEuler = 1; |
424 | _parent_scene.waitForSpaceUnlock(_parent_scene.space); | 424 | _parent_scene.waitForSpaceUnlock(_parent_scene.space); |
425 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); | 425 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); |
426 | 426 | ||
427 | d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); | 427 | d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); |
428 | d.GeomSetCollideBits(Shell, (int)m_collisionFlags); | 428 | d.GeomSetCollideBits(Shell, (int)m_collisionFlags); |
429 | 429 | ||
@@ -442,8 +442,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
442 | 442 | ||
443 | d.GeomSetBody(Shell, Body); | 443 | d.GeomSetBody(Shell, Body); |
444 | 444 | ||
445 | 445 | ||
446 | // The purpose of the AMotor here is to keep the avatar's physical | 446 | // The purpose of the AMotor here is to keep the avatar's physical |
447 | // surrogate from rotating while moving | 447 | // surrogate from rotating while moving |
448 | Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); | 448 | Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); |
449 | d.JointAttach(Amotor, Body, IntPtr.Zero); | 449 | d.JointAttach(Amotor, Body, IntPtr.Zero); |
@@ -455,7 +455,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
455 | d.JointSetAMotorAngle(Amotor, 0, 0); | 455 | d.JointSetAMotorAngle(Amotor, 0, 0); |
456 | d.JointSetAMotorAngle(Amotor, 1, 0); | 456 | d.JointSetAMotorAngle(Amotor, 1, 0); |
457 | d.JointSetAMotorAngle(Amotor, 2, 0); | 457 | d.JointSetAMotorAngle(Amotor, 2, 0); |
458 | 458 | ||
459 | // These lowstops and high stops are effectively (no wiggle room) | 459 | // These lowstops and high stops are effectively (no wiggle room) |
460 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f); | 460 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0.000000000001f); |
461 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f); | 461 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0.000000000001f); |
@@ -464,23 +464,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
464 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f); | 464 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f); |
465 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f); | 465 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f); |
466 | 466 | ||
467 | // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the | 467 | // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the |
468 | // capped cyllinder will fall over | 468 | // capped cyllinder will fall over |
469 | d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); | 469 | d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); |
470 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor); | 470 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, tensor); |
471 | 471 | ||
472 | //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); | 472 | //d.Matrix3 bodyrotation = d.BodyGetRotation(Body); |
473 | //d.QfromR( | 473 | //d.QfromR( |
474 | //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068, | 474 | //d.Matrix3 checkrotation = new d.Matrix3(0.7071068,0.5, -0.7071068, |
475 | // | 475 | // |
476 | //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); | 476 | //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); |
477 | //standupStraight(); | 477 | //standupStraight(); |
478 | 478 | ||
479 | 479 | ||
480 | 480 | ||
481 | } | 481 | } |
482 | 482 | ||
483 | // | 483 | // |
484 | /// <summary> | 484 | /// <summary> |
485 | /// Uses the capped cyllinder volume formula to calculate the avatar's mass. | 485 | /// Uses the capped cyllinder volume formula to calculate the avatar's mass. |
486 | /// This may be used in calculations in the scene/scenepresence | 486 | /// This may be used in calculations in the scene/scenepresence |
@@ -508,13 +508,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
508 | 508 | ||
509 | } | 509 | } |
510 | 510 | ||
511 | // This code is very useful. Written by DanX0r. We're just not using it right now. | 511 | // This code is very useful. Written by DanX0r. We're just not using it right now. |
512 | // Commented out to prevent a warning. | 512 | // Commented out to prevent a warning. |
513 | // | 513 | // |
514 | // private void standupStraight() | 514 | // private void standupStraight() |
515 | // { | 515 | // { |
516 | // // The purpose of this routine here is to quickly stabilize the Body while it's popped up in the air. | 516 | // // The purpose of this routine here is to quickly stabilize the Body while it's popped up in the air. |
517 | // // The amotor needs a few seconds to stabilize so without it, the avatar shoots up sky high when you | 517 | // // The amotor needs a few seconds to stabilize so without it, the avatar shoots up sky high when you |
518 | // // change appearance and when you enter the simulator | 518 | // // change appearance and when you enter the simulator |
519 | // // After this routine is done, the amotor stabilizes much quicker | 519 | // // After this routine is done, the amotor stabilizes much quicker |
520 | // d.Vector3 feet; | 520 | // d.Vector3 feet; |
@@ -558,7 +558,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
558 | if (_zeroFlag) | 558 | if (_zeroFlag) |
559 | return new PhysicsVector(0f, 0f, 0f); | 559 | return new PhysicsVector(0f, 0f, 0f); |
560 | m_lastUpdateSent = false; | 560 | m_lastUpdateSent = false; |
561 | return _velocity; | 561 | return _velocity; |
562 | } | 562 | } |
563 | set | 563 | set |
564 | { | 564 | { |
@@ -601,7 +601,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
601 | } | 601 | } |
602 | 602 | ||
603 | /// <summary> | 603 | /// <summary> |
604 | /// Adds the force supplied to the Target Velocity | 604 | /// Adds the force supplied to the Target Velocity |
605 | /// The PID controller takes this target velocity and tries to make it a reality | 605 | /// The PID controller takes this target velocity and tries to make it a reality |
606 | /// </summary> | 606 | /// </summary> |
607 | /// <param name="force"></param> | 607 | /// <param name="force"></param> |
@@ -616,7 +616,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
616 | // _target_velocity.Y += force.Y; | 616 | // _target_velocity.Y += force.Y; |
617 | //_target_velocity.Z += force.Z; | 617 | //_target_velocity.Z += force.Z; |
618 | } | 618 | } |
619 | else | 619 | else |
620 | { | 620 | { |
621 | m_pidControllerActive = true; | 621 | m_pidControllerActive = true; |
622 | _target_velocity.X += force.X; | 622 | _target_velocity.X += force.X; |
@@ -637,7 +637,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
637 | d.BodyAddForce(Body, force.X, force.Y, force.Z); | 637 | d.BodyAddForce(Body, force.X, force.Y, force.Z); |
638 | //d.BodySetRotation(Body, ref m_StandUpRotation); | 638 | //d.BodySetRotation(Body, ref m_StandUpRotation); |
639 | //standupStraight(); | 639 | //standupStraight(); |
640 | 640 | ||
641 | } | 641 | } |
642 | } | 642 | } |
643 | 643 | ||
@@ -655,16 +655,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
655 | { | 655 | { |
656 | // no lock; for now it's only called from within Simulate() | 656 | // no lock; for now it's only called from within Simulate() |
657 | 657 | ||
658 | // If the PID Controller isn't active then we set our force | 658 | // If the PID Controller isn't active then we set our force |
659 | // calculating base velocity to the current position | 659 | // calculating base velocity to the current position |
660 | 660 | ||
661 | 661 | ||
662 | if (m_pidControllerActive == false) | 662 | if (m_pidControllerActive == false) |
663 | { | 663 | { |
664 | _zeroPosition = d.BodyGetPosition(Body); | 664 | _zeroPosition = d.BodyGetPosition(Body); |
665 | } | 665 | } |
666 | //PidStatus = true; | 666 | //PidStatus = true; |
667 | 667 | ||
668 | PhysicsVector vec = new PhysicsVector(); | 668 | PhysicsVector vec = new PhysicsVector(); |
669 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 669 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
670 | float movementdivisor = 1f; | 670 | float movementdivisor = 1f; |
@@ -798,13 +798,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
798 | _velocity.X = 0.0f; | 798 | _velocity.X = 0.0f; |
799 | _velocity.Y = 0.0f; | 799 | _velocity.Y = 0.0f; |
800 | _velocity.Z = 0.0f; | 800 | _velocity.Z = 0.0f; |
801 | 801 | ||
802 | // Did we send out the 'stopped' message? | 802 | // Did we send out the 'stopped' message? |
803 | if (!m_lastUpdateSent) | 803 | if (!m_lastUpdateSent) |
804 | { | 804 | { |
805 | m_lastUpdateSent = true; | 805 | m_lastUpdateSent = true; |
806 | //base.RequestPhysicsterseUpdate(); | 806 | //base.RequestPhysicsterseUpdate(); |
807 | 807 | ||
808 | } | 808 | } |
809 | } | 809 | } |
810 | else | 810 | else |
@@ -815,7 +815,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
815 | _velocity.Y = (vec.Y); | 815 | _velocity.Y = (vec.Y); |
816 | 816 | ||
817 | _velocity.Z = (vec.Z); | 817 | _velocity.Z = (vec.Z); |
818 | 818 | ||
819 | if (_velocity.Z < -6 && !m_hackSentFall) | 819 | if (_velocity.Z < -6 && !m_hackSentFall) |
820 | { | 820 | { |
821 | m_hackSentFall = true; | 821 | m_hackSentFall = true; |
@@ -849,7 +849,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
849 | 849 | ||
850 | d.GeomDestroy(Shell); | 850 | d.GeomDestroy(Shell); |
851 | _parent_scene.geom_name_map.Remove(Shell); | 851 | _parent_scene.geom_name_map.Remove(Shell); |
852 | 852 | ||
853 | //kill the body | 853 | //kill the body |
854 | d.BodyDestroy(Body); | 854 | d.BodyDestroy(Body); |
855 | } | 855 | } |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 37a8b77..f1886e4 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -111,7 +111,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
111 | private IntPtr _linkJointGroup = (IntPtr)0; | 111 | private IntPtr _linkJointGroup = (IntPtr)0; |
112 | private PhysicsActor _parent = null; | 112 | private PhysicsActor _parent = null; |
113 | private PhysicsActor m_taintparent = null; | 113 | private PhysicsActor m_taintparent = null; |
114 | 114 | ||
115 | private bool iscolliding = false; | 115 | private bool iscolliding = false; |
116 | private bool m_isphysical = false; | 116 | private bool m_isphysical = false; |
117 | private bool m_isSelected = false; | 117 | private bool m_isSelected = false; |
@@ -202,7 +202,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
202 | m_taintadd = true; | 202 | m_taintadd = true; |
203 | _parent_scene.AddPhysicsActorTaint(this); | 203 | _parent_scene.AddPhysicsActorTaint(this); |
204 | // don't do .add() here; old geoms get recycled with the same hash | 204 | // don't do .add() here; old geoms get recycled with the same hash |
205 | 205 | ||
206 | } | 206 | } |
207 | 207 | ||
208 | public override int PhysicsActorType | 208 | public override int PhysicsActorType |
@@ -232,9 +232,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
232 | public override bool Selected | 232 | public override bool Selected |
233 | { | 233 | { |
234 | set { | 234 | set { |
235 | // This only makes the object not collidable if the object | 235 | // This only makes the object not collidable if the object |
236 | // is physical or the object is modified somehow *IN THE FUTURE* | 236 | // is physical or the object is modified somehow *IN THE FUTURE* |
237 | // without this, if an avatar selects prim, they can walk right | 237 | // without this, if an avatar selects prim, they can walk right |
238 | // through it while it's selected | 238 | // through it while it's selected |
239 | 239 | ||
240 | if ((m_isphysical && !_zeroFlag) || !value) | 240 | if ((m_isphysical && !_zeroFlag) || !value) |
@@ -262,7 +262,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
262 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); | 262 | d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); |
263 | } | 263 | } |
264 | //m_log.Warn("Setting Geom to: " + prim_geom); | 264 | //m_log.Warn("Setting Geom to: " + prim_geom); |
265 | 265 | ||
266 | } | 266 | } |
267 | 267 | ||
268 | public void enableBodySoft() | 268 | public void enableBodySoft() |
@@ -277,7 +277,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
277 | public void disableBodySoft() | 277 | public void disableBodySoft() |
278 | { | 278 | { |
279 | m_disabled = true; | 279 | m_disabled = true; |
280 | 280 | ||
281 | if (m_isphysical) | 281 | if (m_isphysical) |
282 | if (Body != (IntPtr)0) | 282 | if (Body != (IntPtr)0) |
283 | d.BodyDisable(Body); | 283 | d.BodyDisable(Body); |
@@ -307,7 +307,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
307 | 307 | ||
308 | d.BodySetAutoDisableFlag(Body, true); | 308 | d.BodySetAutoDisableFlag(Body, true); |
309 | d.BodySetAutoDisableSteps(Body, 20); | 309 | d.BodySetAutoDisableSteps(Body, 20); |
310 | 310 | ||
311 | m_interpenetrationcount = 0; | 311 | m_interpenetrationcount = 0; |
312 | m_collisionscore = 0; | 312 | m_collisionscore = 0; |
313 | m_disabled = false; | 313 | m_disabled = false; |
@@ -327,7 +327,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
327 | { | 327 | { |
328 | float volume = 0; | 328 | float volume = 0; |
329 | 329 | ||
330 | // No material is passed to the physics engines yet.. soo.. | 330 | // No material is passed to the physics engines yet.. soo.. |
331 | // we're using the m_density constant in the class definition | 331 | // we're using the m_density constant in the class definition |
332 | 332 | ||
333 | 333 | ||
@@ -340,7 +340,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
340 | 340 | ||
341 | volume = _size.X*_size.Y*_size.Z; | 341 | volume = _size.X*_size.Y*_size.Z; |
342 | 342 | ||
343 | // If the user has 'hollowed out' | 343 | // If the user has 'hollowed out' |
344 | // ProfileHollow is one of those 0 to 50000 values :P | 344 | // ProfileHollow is one of those 0 to 50000 values :P |
345 | // we like percentages better.. so turning into a percentage | 345 | // we like percentages better.. so turning into a percentage |
346 | 346 | ||
@@ -415,7 +415,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
415 | // We don't know what the shape is yet, so use default | 415 | // We don't know what the shape is yet, so use default |
416 | volume = _size.X * _size.Y * _size.Z; | 416 | volume = _size.X * _size.Y * _size.Z; |
417 | } | 417 | } |
418 | // If the user has 'hollowed out' | 418 | // If the user has 'hollowed out' |
419 | // ProfileHollow is one of those 0 to 50000 values :P | 419 | // ProfileHollow is one of those 0 to 50000 values :P |
420 | // we like percentages better.. so turning into a percentage | 420 | // we like percentages better.. so turning into a percentage |
421 | 421 | ||
@@ -427,8 +427,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
427 | float hollowVolume = 0; | 427 | float hollowVolume = 0; |
428 | switch (_pbs.HollowShape) | 428 | switch (_pbs.HollowShape) |
429 | { | 429 | { |
430 | 430 | ||
431 | case HollowShape.Same: | 431 | case HollowShape.Same: |
432 | case HollowShape.Circle: | 432 | case HollowShape.Circle: |
433 | // Hollow shape is a perfect cyllinder in respect to the cube's scale | 433 | // Hollow shape is a perfect cyllinder in respect to the cube's scale |
434 | // Cyllinder hollow volume calculation | 434 | // Cyllinder hollow volume calculation |
@@ -447,7 +447,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
447 | hollowVolume = hollowsizex * hollowsizey * hollowsizez; | 447 | hollowVolume = hollowsizex * hollowsizey * hollowsizez; |
448 | break; | 448 | break; |
449 | 449 | ||
450 | 450 | ||
451 | 451 | ||
452 | case HollowShape.Triangle: | 452 | case HollowShape.Triangle: |
453 | // Equilateral Triangular Prism volume hollow calculation | 453 | // Equilateral Triangular Prism volume hollow calculation |
@@ -465,7 +465,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
465 | volume = volume - hollowVolume; | 465 | volume = volume - hollowVolume; |
466 | } | 466 | } |
467 | break; | 467 | break; |
468 | 468 | ||
469 | case ProfileShape.HalfCircle: | 469 | case ProfileShape.HalfCircle: |
470 | if (_pbs.PathCurve == (byte)Extrusion.Curve1) | 470 | if (_pbs.PathCurve == (byte)Extrusion.Curve1) |
471 | { | 471 | { |
@@ -490,13 +490,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
490 | } | 490 | } |
491 | break; | 491 | break; |
492 | case ProfileShape.EquilateralTriangle: | 492 | case ProfileShape.EquilateralTriangle: |
493 | /* | 493 | /* |
494 | v = (abs((xB*yA-xA*yB)+(xC*yB-xB*yC)+(xA*yC-xC*yA))/2) * h | 494 | v = (abs((xB*yA-xA*yB)+(xC*yB-xB*yC)+(xA*yC-xC*yA))/2) * h |
495 | 495 | ||
496 | // seed mesh | 496 | // seed mesh |
497 | Vertex MM = new Vertex(-0.25f, -0.45f, 0.0f); | 497 | Vertex MM = new Vertex(-0.25f, -0.45f, 0.0f); |
498 | Vertex PM = new Vertex(+0.5f, 0f, 0.0f); | 498 | Vertex PM = new Vertex(+0.5f, 0f, 0.0f); |
499 | Vertex PP = new Vertex(-0.25f, +0.45f, 0.0f); | 499 | Vertex PP = new Vertex(-0.25f, +0.45f, 0.0f); |
500 | */ | 500 | */ |
501 | float xA = -0.25f * _size.X; | 501 | float xA = -0.25f * _size.X; |
502 | float yA = -0.45f * _size.Y; | 502 | float yA = -0.45f * _size.Y; |
@@ -509,7 +509,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
509 | 509 | ||
510 | volume = (float)((Math.Abs((xB * yA - xA * yB) + (xC * yB - xB * yC) + (xA * yC - xC * yA)) / 2) * _size.Z); | 510 | volume = (float)((Math.Abs((xB * yA - xA * yB) + (xC * yB - xB * yC) + (xA * yC - xC * yA)) / 2) * _size.Z); |
511 | 511 | ||
512 | // If the user has 'hollowed out' | 512 | // If the user has 'hollowed out' |
513 | // ProfileHollow is one of those 0 to 50000 values :P | 513 | // ProfileHollow is one of those 0 to 50000 values :P |
514 | // we like percentages better.. so turning into a percentage | 514 | // we like percentages better.. so turning into a percentage |
515 | float fhollowFactor = ((float)_pbs.ProfileHollow / 1.9f); | 515 | float fhollowFactor = ((float)_pbs.ProfileHollow / 1.9f); |
@@ -521,7 +521,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
521 | float hollowVolume = 0; | 521 | float hollowVolume = 0; |
522 | switch (_pbs.HollowShape) | 522 | switch (_pbs.HollowShape) |
523 | { | 523 | { |
524 | 524 | ||
525 | case HollowShape.Same: | 525 | case HollowShape.Same: |
526 | case HollowShape.Triangle: | 526 | case HollowShape.Triangle: |
527 | // Equilateral Triangular Prism volume hollow calculation | 527 | // Equilateral Triangular Prism volume hollow calculation |
@@ -550,7 +550,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
550 | hollowVolume = ((float)((Math.PI * Math.Pow(hRadius, 2) * hLength)/2) * hollowAmount); | 550 | hollowVolume = ((float)((Math.PI * Math.Pow(hRadius, 2) * hLength)/2) * hollowAmount); |
551 | break; | 551 | break; |
552 | 552 | ||
553 | 553 | ||
554 | default: | 554 | default: |
555 | hollowVolume = 0; | 555 | hollowVolume = 0; |
556 | break; | 556 | break; |
@@ -560,7 +560,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
560 | break; | 560 | break; |
561 | 561 | ||
562 | default: | 562 | default: |
563 | // we don't have all of the volume formulas yet so | 563 | // we don't have all of the volume formulas yet so |
564 | // use the common volume formula for all | 564 | // use the common volume formula for all |
565 | volume = _size.X*_size.Y*_size.Z; | 565 | volume = _size.X*_size.Y*_size.Z; |
566 | break; | 566 | break; |
@@ -568,7 +568,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
568 | 568 | ||
569 | // Calculate Path cut effect on volume | 569 | // Calculate Path cut effect on volume |
570 | // Not exact, in the triangle hollow example | 570 | // Not exact, in the triangle hollow example |
571 | // They should never be zero or less then zero.. | 571 | // They should never be zero or less then zero.. |
572 | // we'll ignore it if it's less then zero | 572 | // we'll ignore it if it's less then zero |
573 | 573 | ||
574 | // ProfileEnd and ProfileBegin are values | 574 | // ProfileEnd and ProfileBegin are values |
@@ -672,11 +672,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
672 | 672 | ||
673 | public void setMesh(OdeScene parent_scene, IMesh mesh) | 673 | public void setMesh(OdeScene parent_scene, IMesh mesh) |
674 | { | 674 | { |
675 | // This sleeper is there to moderate how long it takes between | 675 | // This sleeper is there to moderate how long it takes between |
676 | // setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object | 676 | // setting up the mesh and pre-processing it when we get rapid fire mesh requests on a single object |
677 | 677 | ||
678 | Thread.Sleep(10); | 678 | Thread.Sleep(10); |
679 | 679 | ||
680 | //Kill Body so that mesh can re-make the geom | 680 | //Kill Body so that mesh can re-make the geom |
681 | if (IsPhysical && Body != (IntPtr) 0) | 681 | if (IsPhysical && Body != (IntPtr) 0) |
682 | { | 682 | { |
@@ -694,9 +694,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
694 | 3*sizeof (int)); | 694 | 3*sizeof (int)); |
695 | d.GeomTriMeshDataPreprocess(_triMeshData); | 695 | d.GeomTriMeshDataPreprocess(_triMeshData); |
696 | 696 | ||
697 | 697 | ||
698 | _parent_scene.waitForSpaceUnlock(m_targetSpace); | 698 | _parent_scene.waitForSpaceUnlock(m_targetSpace); |
699 | 699 | ||
700 | try | 700 | try |
701 | { | 701 | { |
702 | if (prim_geom == (IntPtr)0) | 702 | if (prim_geom == (IntPtr)0) |
@@ -706,7 +706,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
706 | } | 706 | } |
707 | catch (AccessViolationException) | 707 | catch (AccessViolationException) |
708 | { | 708 | { |
709 | 709 | ||
710 | m_log.Error("[PHYSICS]: MESH LOCKED"); | 710 | m_log.Error("[PHYSICS]: MESH LOCKED"); |
711 | return; | 711 | return; |
712 | } | 712 | } |
@@ -715,7 +715,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
715 | // Recreate the body | 715 | // Recreate the body |
716 | m_interpenetrationcount = 0; | 716 | m_interpenetrationcount = 0; |
717 | m_collisionscore = 0; | 717 | m_collisionscore = 0; |
718 | 718 | ||
719 | enableBody(); | 719 | enableBody(); |
720 | 720 | ||
721 | } | 721 | } |
@@ -724,7 +724,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
724 | public void ProcessTaints(float timestep) | 724 | public void ProcessTaints(float timestep) |
725 | { | 725 | { |
726 | 726 | ||
727 | 727 | ||
728 | if (m_taintadd) | 728 | if (m_taintadd) |
729 | { | 729 | { |
730 | changeadd(timestep); | 730 | changeadd(timestep); |
@@ -779,7 +779,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
779 | } | 779 | } |
780 | 780 | ||
781 | private void changeAngularLock(float timestep) | 781 | private void changeAngularLock(float timestep) |
782 | { | 782 | { |
783 | // do we have a Physical object? | 783 | // do we have a Physical object? |
784 | if (Body != IntPtr.Zero) | 784 | if (Body != IntPtr.Zero) |
785 | { | 785 | { |
@@ -809,7 +809,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
809 | 809 | ||
810 | private void changelink(float timestep) | 810 | private void changelink(float timestep) |
811 | { | 811 | { |
812 | 812 | ||
813 | if (_parent == null && m_taintparent != null) | 813 | if (_parent == null && m_taintparent != null) |
814 | { | 814 | { |
815 | if (m_taintparent.PhysicsActorType == (int)ActorTypes.Prim) | 815 | if (m_taintparent.PhysicsActorType == (int)ActorTypes.Prim) |
@@ -834,14 +834,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
834 | m_linkJoint = (IntPtr)0; | 834 | m_linkJoint = (IntPtr)0; |
835 | 835 | ||
836 | } | 836 | } |
837 | 837 | ||
838 | 838 | ||
839 | _parent = m_taintparent; | 839 | _parent = m_taintparent; |
840 | } | 840 | } |
841 | 841 | ||
842 | private void changeSelectedStatus(float timestep) | 842 | private void changeSelectedStatus(float timestep) |
843 | { | 843 | { |
844 | 844 | ||
845 | if (m_taintselected) | 845 | if (m_taintselected) |
846 | { | 846 | { |
847 | 847 | ||
@@ -849,9 +849,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
849 | m_collisionCategories = CollisionCategories.Selected; | 849 | m_collisionCategories = CollisionCategories.Selected; |
850 | m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space); | 850 | m_collisionFlags = (CollisionCategories.Sensor | CollisionCategories.Space); |
851 | 851 | ||
852 | // We do the body disable soft twice because 'in theory' a collision could have happened | 852 | // We do the body disable soft twice because 'in theory' a collision could have happened |
853 | // in between the disabling and the collision properties setting | 853 | // in between the disabling and the collision properties setting |
854 | // which would wake the physical body up from a soft disabling and potentially cause it to fall | 854 | // which would wake the physical body up from a soft disabling and potentially cause it to fall |
855 | // through the ground. | 855 | // through the ground. |
856 | 856 | ||
857 | if (m_isphysical) | 857 | if (m_isphysical) |
@@ -873,9 +873,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
873 | } | 873 | } |
874 | else | 874 | else |
875 | { | 875 | { |
876 | 876 | ||
877 | m_collisionCategories = CollisionCategories.Geom; | 877 | m_collisionCategories = CollisionCategories.Geom; |
878 | 878 | ||
879 | if (m_isphysical) | 879 | if (m_isphysical) |
880 | m_collisionCategories |= CollisionCategories.Body; | 880 | m_collisionCategories |= CollisionCategories.Body; |
881 | 881 | ||
@@ -898,10 +898,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
898 | enableBodySoft(); | 898 | enableBodySoft(); |
899 | } | 899 | } |
900 | 900 | ||
901 | 901 | ||
902 | } | 902 | } |
903 | 903 | ||
904 | 904 | ||
905 | resetCollisionAccounting(); | 905 | resetCollisionAccounting(); |
906 | m_isSelected = m_taintselected; | 906 | m_isSelected = m_taintselected; |
907 | } | 907 | } |
@@ -918,21 +918,21 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
918 | m_taintselected = m_isSelected; | 918 | m_taintselected = m_isSelected; |
919 | 919 | ||
920 | m_taintsize = _size; | 920 | m_taintsize = _size; |
921 | 921 | ||
922 | 922 | ||
923 | m_taintshape = false; | 923 | m_taintshape = false; |
924 | 924 | ||
925 | m_taintforce = false; | 925 | m_taintforce = false; |
926 | 926 | ||
927 | m_taintdisable = false; | 927 | m_taintdisable = false; |
928 | 928 | ||
929 | m_taintVelocity = PhysicsVector.Zero; | 929 | m_taintVelocity = PhysicsVector.Zero; |
930 | } | 930 | } |
931 | public void changeadd(float timestep) | 931 | public void changeadd(float timestep) |
932 | { | 932 | { |
933 | 933 | ||
934 | 934 | ||
935 | 935 | ||
936 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); | 936 | int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); |
937 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); | 937 | IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); |
938 | 938 | ||
@@ -941,7 +941,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
941 | 941 | ||
942 | m_targetSpace = targetspace; | 942 | m_targetSpace = targetspace; |
943 | 943 | ||
944 | 944 | ||
945 | 945 | ||
946 | if (_mesh != null) | 946 | if (_mesh != null) |
947 | { | 947 | { |
@@ -1010,7 +1010,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1010 | { | 1010 | { |
1011 | m_log.Warn("[PHYSICS]: Unable to create physics proxy for object"); | 1011 | m_log.Warn("[PHYSICS]: Unable to create physics proxy for object"); |
1012 | ode.dunlock(_parent_scene.world); | 1012 | ode.dunlock(_parent_scene.world); |
1013 | return; | 1013 | return; |
1014 | } | 1014 | } |
1015 | } | 1015 | } |
1016 | } | 1016 | } |
@@ -1060,7 +1060,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1060 | 1060 | ||
1061 | 1061 | ||
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | _parent_scene.geom_name_map[prim_geom] = this.m_primName; | 1064 | _parent_scene.geom_name_map[prim_geom] = this.m_primName; |
1065 | _parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this; | 1065 | _parent_scene.actor_name_map[prim_geom] = (PhysicsActor)this; |
1066 | 1066 | ||
@@ -1072,7 +1072,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1072 | } | 1072 | } |
1073 | public void changemove(float timestep) | 1073 | public void changemove(float timestep) |
1074 | { | 1074 | { |
1075 | 1075 | ||
1076 | 1076 | ||
1077 | 1077 | ||
1078 | if (m_isphysical) | 1078 | if (m_isphysical) |
@@ -1080,7 +1080,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1080 | // This is a fallback.. May no longer be necessary. | 1080 | // This is a fallback.. May no longer be necessary. |
1081 | if (Body == (IntPtr) 0) | 1081 | if (Body == (IntPtr) 0) |
1082 | enableBody(); | 1082 | enableBody(); |
1083 | //Prim auto disable after 20 frames, | 1083 | //Prim auto disable after 20 frames, |
1084 | //if you move it, re-enable the prim manually. | 1084 | //if you move it, re-enable the prim manually. |
1085 | if (_parent != null) | 1085 | if (_parent != null) |
1086 | { | 1086 | { |
@@ -1102,7 +1102,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1102 | } | 1102 | } |
1103 | } | 1103 | } |
1104 | d.BodyEnable(Body); | 1104 | d.BodyEnable(Body); |
1105 | 1105 | ||
1106 | } | 1106 | } |
1107 | else | 1107 | else |
1108 | { | 1108 | { |
@@ -1122,10 +1122,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1122 | d.SpaceAdd(m_targetSpace, prim_geom); | 1122 | d.SpaceAdd(m_targetSpace, prim_geom); |
1123 | } | 1123 | } |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | 1126 | ||
1127 | changeSelectedStatus(timestep); | 1127 | changeSelectedStatus(timestep); |
1128 | 1128 | ||
1129 | resetCollisionAccounting(); | 1129 | resetCollisionAccounting(); |
1130 | m_taintposition = _position; | 1130 | m_taintposition = _position; |
1131 | } | 1131 | } |
@@ -1140,42 +1140,42 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1140 | { | 1140 | { |
1141 | float PID_D = 2200.0f; | 1141 | float PID_D = 2200.0f; |
1142 | //float PID_P = 900.0f; | 1142 | //float PID_P = 900.0f; |
1143 | 1143 | ||
1144 | 1144 | ||
1145 | float m_mass = CalculateMass(); | 1145 | float m_mass = CalculateMass(); |
1146 | 1146 | ||
1147 | fz = 0f; | 1147 | fz = 0f; |
1148 | //m_log.Info(m_collisionFlags.ToString()); | 1148 | //m_log.Info(m_collisionFlags.ToString()); |
1149 | 1149 | ||
1150 | 1150 | ||
1151 | 1151 | ||
1152 | 1152 | ||
1153 | if (m_buoyancy != 0) | 1153 | if (m_buoyancy != 0) |
1154 | { | 1154 | { |
1155 | 1155 | ||
1156 | if (m_buoyancy > 0) | 1156 | if (m_buoyancy > 0) |
1157 | { | 1157 | { |
1158 | fz = (((-1 * _parent_scene.gravityz) * m_buoyancy) * m_mass); | 1158 | fz = (((-1 * _parent_scene.gravityz) * m_buoyancy) * m_mass); |
1159 | 1159 | ||
1160 | //d.Vector3 l_velocity = d.BodyGetLinearVel(Body); | 1160 | //d.Vector3 l_velocity = d.BodyGetLinearVel(Body); |
1161 | //m_log.Info("Using Buoyancy: " + buoyancy + " G: " + (_parent_scene.gravityz * m_buoyancy) + "mass:" + m_mass + " Pos: " + Position.ToString()); | 1161 | //m_log.Info("Using Buoyancy: " + buoyancy + " G: " + (_parent_scene.gravityz * m_buoyancy) + "mass:" + m_mass + " Pos: " + Position.ToString()); |
1162 | } | 1162 | } |
1163 | else | 1163 | else |
1164 | { | 1164 | { |
1165 | fz = (-1 * (((-1 * _parent_scene.gravityz) * (-1 * m_buoyancy)) * m_mass)); | 1165 | fz = (-1 * (((-1 * _parent_scene.gravityz) * (-1 * m_buoyancy)) * m_mass)); |
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | 1168 | ||
1169 | } | 1169 | } |
1170 | 1170 | ||
1171 | if (m_usePID) | 1171 | if (m_usePID) |
1172 | { | 1172 | { |
1173 | // If we're using the PID controller, then we have no gravity | 1173 | // If we're using the PID controller, then we have no gravity |
1174 | fz = (-1 * _parent_scene.gravityz) * this.Mass; | 1174 | fz = (-1 * _parent_scene.gravityz) * this.Mass; |
1175 | 1175 | ||
1176 | // no lock; for now it's only called from within Simulate() | 1176 | // no lock; for now it's only called from within Simulate() |
1177 | 1177 | ||
1178 | // If the PID Controller isn't active then we set our force | 1178 | // If the PID Controller isn't active then we set our force |
1179 | // calculating base velocity to the current position | 1179 | // calculating base velocity to the current position |
1180 | if (Environment.OSVersion.Platform == PlatformID.Unix) | 1180 | if (Environment.OSVersion.Platform == PlatformID.Unix) |
1181 | { | 1181 | { |
@@ -1189,7 +1189,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1189 | } | 1189 | } |
1190 | PID_D = 35f; | 1190 | PID_D = 35f; |
1191 | 1191 | ||
1192 | 1192 | ||
1193 | //PID_P = 1.0f; | 1193 | //PID_P = 1.0f; |
1194 | float PID_G = 25; | 1194 | float PID_G = 25; |
1195 | 1195 | ||
@@ -1197,7 +1197,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1197 | { | 1197 | { |
1198 | PID_G = PID_G / m_PIDTau; | 1198 | PID_G = PID_G / m_PIDTau; |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | 1201 | ||
1202 | if ((PID_G - m_PIDTau) <= 0) | 1202 | if ((PID_G - m_PIDTau) <= 0) |
1203 | { | 1203 | { |
@@ -1205,15 +1205,15 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1205 | } | 1205 | } |
1206 | //PidStatus = true; | 1206 | //PidStatus = true; |
1207 | 1207 | ||
1208 | 1208 | ||
1209 | 1209 | ||
1210 | 1210 | ||
1211 | PhysicsVector vec = new PhysicsVector(); | 1211 | PhysicsVector vec = new PhysicsVector(); |
1212 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 1212 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
1213 | 1213 | ||
1214 | 1214 | ||
1215 | d.Vector3 pos = d.BodyGetPosition(Body); | 1215 | d.Vector3 pos = d.BodyGetPosition(Body); |
1216 | _target_velocity = | 1216 | _target_velocity = |
1217 | new PhysicsVector( | 1217 | new PhysicsVector( |
1218 | (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), | 1218 | (m_PIDTarget.X - pos.X) * ((PID_G - m_PIDTau) * timestep), |
1219 | (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), | 1219 | (m_PIDTarget.Y - pos.Y) * ((PID_G - m_PIDTau) * timestep), |
@@ -1222,18 +1222,18 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1222 | 1222 | ||
1223 | 1223 | ||
1224 | // if velocity is zero, use position control; otherwise, velocity control | 1224 | // if velocity is zero, use position control; otherwise, velocity control |
1225 | 1225 | ||
1226 | if (_target_velocity.IsIdentical(PhysicsVector.Zero,0.1f)) | 1226 | if (_target_velocity.IsIdentical(PhysicsVector.Zero,0.1f)) |
1227 | { | 1227 | { |
1228 | // keep track of where we stopped. No more slippin' & slidin' | 1228 | // keep track of where we stopped. No more slippin' & slidin' |
1229 | 1229 | ||
1230 | 1230 | ||
1231 | // We only want to deactivate the PID Controller if we think we want to have our surrogate | 1231 | // We only want to deactivate the PID Controller if we think we want to have our surrogate |
1232 | // react to the physics scene by moving it's position. | 1232 | // react to the physics scene by moving it's position. |
1233 | // Avatar to Avatar collisions | 1233 | // Avatar to Avatar collisions |
1234 | // Prim to avatar collisions | 1234 | // Prim to avatar collisions |
1235 | 1235 | ||
1236 | 1236 | ||
1237 | //fx = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2); | 1237 | //fx = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2); |
1238 | //fy = (_target_velocity.Y - vel.Y) * (PID_D) + (_zeroPosition.Y - pos.Y) * (PID_P * 2); | 1238 | //fy = (_target_velocity.Y - vel.Y) * (PID_D) + (_zeroPosition.Y - pos.Y) * (PID_P * 2); |
1239 | //fz = fz + (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; | 1239 | //fz = fz + (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; |
@@ -1245,27 +1245,27 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1245 | } | 1245 | } |
1246 | else | 1246 | else |
1247 | { | 1247 | { |
1248 | 1248 | ||
1249 | _zeroFlag = false; | 1249 | _zeroFlag = false; |
1250 | 1250 | ||
1251 | // We're flying and colliding with something | 1251 | // We're flying and colliding with something |
1252 | fx = ((_target_velocity.X) - vel.X) * (PID_D); | 1252 | fx = ((_target_velocity.X) - vel.X) * (PID_D); |
1253 | fy = ((_target_velocity.Y) - vel.Y) * (PID_D); | 1253 | fy = ((_target_velocity.Y) - vel.Y) * (PID_D); |
1254 | |||
1255 | 1254 | ||
1256 | 1255 | ||
1257 | 1256 | ||
1257 | |||
1258 | // vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; | 1258 | // vec.Z = (_target_velocity.Z - vel.Z) * PID_D + (_zeroPosition.Z - pos.Z) * PID_P; |
1259 | 1259 | ||
1260 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); | 1260 | fz = fz + ((_target_velocity.Z - vel.Z) * (PID_D) * m_mass); |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | fx *= m_mass; | 1265 | fx *= m_mass; |
1266 | fy *= m_mass; | 1266 | fy *= m_mass; |
1267 | //fz *= m_mass; | 1267 | //fz *= m_mass; |
1268 | 1268 | ||
1269 | //m_log.Info("[OBJPID]: X:" + fx.ToString() + " Y:" + fy.ToString() + " Z:" + fz.ToString()); | 1269 | //m_log.Info("[OBJPID]: X:" + fx.ToString() + " Y:" + fy.ToString() + " Z:" + fz.ToString()); |
1270 | if (fx != 0 || fy != 0 || fz != 0) | 1270 | if (fx != 0 || fy != 0 || fz != 0) |
1271 | { | 1271 | { |
@@ -1285,7 +1285,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1285 | 1285 | ||
1286 | public void rotate(float timestep) | 1286 | public void rotate(float timestep) |
1287 | { | 1287 | { |
1288 | 1288 | ||
1289 | 1289 | ||
1290 | d.Quaternion myrot = new d.Quaternion(); | 1290 | d.Quaternion myrot = new d.Quaternion(); |
1291 | myrot.W = _orientation.w; | 1291 | myrot.W = _orientation.w; |
@@ -1299,7 +1299,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1299 | if (!m_angularlock.IsIdentical(new PhysicsVector(1, 1, 1), 0)) | 1299 | if (!m_angularlock.IsIdentical(new PhysicsVector(1, 1, 1), 0)) |
1300 | createAMotor(m_angularlock); | 1300 | createAMotor(m_angularlock); |
1301 | } | 1301 | } |
1302 | 1302 | ||
1303 | resetCollisionAccounting(); | 1303 | resetCollisionAccounting(); |
1304 | m_taintrot = _orientation; | 1304 | m_taintrot = _orientation; |
1305 | } | 1305 | } |
@@ -1313,21 +1313,21 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1313 | 1313 | ||
1314 | public void changedisable(float timestep) | 1314 | public void changedisable(float timestep) |
1315 | { | 1315 | { |
1316 | 1316 | ||
1317 | m_disabled = true; | 1317 | m_disabled = true; |
1318 | if (Body != (IntPtr)0) | 1318 | if (Body != (IntPtr)0) |
1319 | { | 1319 | { |
1320 | d.BodyDisable(Body); | 1320 | d.BodyDisable(Body); |
1321 | Body = (IntPtr)0; | 1321 | Body = (IntPtr)0; |
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | 1324 | ||
1325 | m_taintdisable = false; | 1325 | m_taintdisable = false; |
1326 | } | 1326 | } |
1327 | 1327 | ||
1328 | public void changePhysicsStatus(float timestep) | 1328 | public void changePhysicsStatus(float timestep) |
1329 | { | 1329 | { |
1330 | 1330 | ||
1331 | 1331 | ||
1332 | if (m_isphysical == true) | 1332 | if (m_isphysical == true) |
1333 | { | 1333 | { |
@@ -1352,7 +1352,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1352 | 1352 | ||
1353 | public void changesize(float timestamp) | 1353 | public void changesize(float timestamp) |
1354 | { | 1354 | { |
1355 | 1355 | ||
1356 | //if (!_parent_scene.geom_name_map.ContainsKey(prim_geom)) | 1356 | //if (!_parent_scene.geom_name_map.ContainsKey(prim_geom)) |
1357 | //{ | 1357 | //{ |
1358 | // m_taintsize = _size; | 1358 | // m_taintsize = _size; |
@@ -1369,7 +1369,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1369 | { | 1369 | { |
1370 | // Cleanup meshing here | 1370 | // Cleanup meshing here |
1371 | } | 1371 | } |
1372 | //kill body to rebuild | 1372 | //kill body to rebuild |
1373 | if (IsPhysical && Body != (IntPtr) 0) | 1373 | if (IsPhysical && Body != (IntPtr) 0) |
1374 | { | 1374 | { |
1375 | disableBody(); | 1375 | disableBody(); |
@@ -1531,7 +1531,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1531 | { | 1531 | { |
1532 | m_collisionFlags |= CollisionCategories.Water; | 1532 | m_collisionFlags |= CollisionCategories.Water; |
1533 | } | 1533 | } |
1534 | else | 1534 | else |
1535 | { | 1535 | { |
1536 | m_collisionFlags &= ~CollisionCategories.Water; | 1536 | m_collisionFlags &= ~CollisionCategories.Water; |
1537 | } | 1537 | } |
@@ -1541,7 +1541,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1541 | 1541 | ||
1542 | public void changeshape(float timestamp) | 1542 | public void changeshape(float timestamp) |
1543 | { | 1543 | { |
1544 | 1544 | ||
1545 | string oldname = _parent_scene.geom_name_map[prim_geom]; | 1545 | string oldname = _parent_scene.geom_name_map[prim_geom]; |
1546 | 1546 | ||
1547 | // Cleanup of old prim geometry and Bodies | 1547 | // Cleanup of old prim geometry and Bodies |
@@ -1579,7 +1579,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1579 | // Re creates body on size. | 1579 | // Re creates body on size. |
1580 | // EnableBody also does setMass() | 1580 | // EnableBody also does setMass() |
1581 | enableBody(); | 1581 | enableBody(); |
1582 | 1582 | ||
1583 | } | 1583 | } |
1584 | } | 1584 | } |
1585 | else | 1585 | else |
@@ -1684,7 +1684,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1684 | d.BodyEnable(Body); | 1684 | d.BodyEnable(Body); |
1685 | } | 1685 | } |
1686 | } | 1686 | } |
1687 | 1687 | ||
1688 | 1688 | ||
1689 | _parent_scene.geom_name_map[prim_geom] = oldname; | 1689 | _parent_scene.geom_name_map[prim_geom] = oldname; |
1690 | 1690 | ||
@@ -1698,7 +1698,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1698 | { | 1698 | { |
1699 | if (!m_isSelected) | 1699 | if (!m_isSelected) |
1700 | { | 1700 | { |
1701 | 1701 | ||
1702 | 1702 | ||
1703 | 1703 | ||
1704 | lock (m_forcelist) | 1704 | lock (m_forcelist) |
@@ -1728,7 +1728,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1728 | { | 1728 | { |
1729 | if (!m_isSelected) | 1729 | if (!m_isSelected) |
1730 | { | 1730 | { |
1731 | 1731 | ||
1732 | 1732 | ||
1733 | Thread.Sleep(20); | 1733 | Thread.Sleep(20); |
1734 | if (IsPhysical) | 1734 | if (IsPhysical) |
@@ -1737,8 +1737,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1737 | { | 1737 | { |
1738 | d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); | 1738 | d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z); |
1739 | } | 1739 | } |
1740 | } | 1740 | } |
1741 | 1741 | ||
1742 | //resetCollisionAccounting(); | 1742 | //resetCollisionAccounting(); |
1743 | } | 1743 | } |
1744 | m_taintVelocity = PhysicsVector.Zero; | 1744 | m_taintVelocity = PhysicsVector.Zero; |
@@ -1794,7 +1794,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1794 | { | 1794 | { |
1795 | get { return _position; } | 1795 | get { return _position; } |
1796 | 1796 | ||
1797 | set { _position = value; | 1797 | set { _position = value; |
1798 | //m_log.Info("[PHYSICS]: " + _position.ToString()); | 1798 | //m_log.Info("[PHYSICS]: " + _position.ToString()); |
1799 | } | 1799 | } |
1800 | } | 1800 | } |
@@ -1838,7 +1838,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1838 | { | 1838 | { |
1839 | get | 1839 | get |
1840 | { | 1840 | { |
1841 | // Averate previous velocity with the new one so | 1841 | // Averate previous velocity with the new one so |
1842 | // client object interpolation works a 'little' better | 1842 | // client object interpolation works a 'little' better |
1843 | PhysicsVector returnVelocity = new PhysicsVector(); | 1843 | PhysicsVector returnVelocity = new PhysicsVector(); |
1844 | returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; | 1844 | returnVelocity.X = (m_lastVelocity.X + _velocity.X)/2; |
@@ -1849,7 +1849,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1849 | set | 1849 | set |
1850 | { | 1850 | { |
1851 | _velocity = value; | 1851 | _velocity = value; |
1852 | 1852 | ||
1853 | m_taintVelocity = value; | 1853 | m_taintVelocity = value; |
1854 | _parent_scene.AddPhysicsActorTaint(this); | 1854 | _parent_scene.AddPhysicsActorTaint(this); |
1855 | } | 1855 | } |
@@ -1898,11 +1898,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1898 | if (_zeroFlag) | 1898 | if (_zeroFlag) |
1899 | return pv; | 1899 | return pv; |
1900 | m_lastUpdateSent = false; | 1900 | m_lastUpdateSent = false; |
1901 | 1901 | ||
1902 | if (m_rotationalVelocity.IsIdentical(pv, 0.2f)) | 1902 | if (m_rotationalVelocity.IsIdentical(pv, 0.2f)) |
1903 | return pv; | 1903 | return pv; |
1904 | 1904 | ||
1905 | return m_rotationalVelocity; | 1905 | return m_rotationalVelocity; |
1906 | } | 1906 | } |
1907 | set { m_rotationalVelocity = value; } | 1907 | set { m_rotationalVelocity = value; } |
1908 | } | 1908 | } |
@@ -1948,7 +1948,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1948 | } | 1948 | } |
1949 | 1949 | ||
1950 | public void UpdatePositionAndVelocity() | 1950 | public void UpdatePositionAndVelocity() |
1951 | { | 1951 | { |
1952 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! | 1952 | // no lock; called from Simulate() -- if you call this from elsewhere, gotta lock or do Monitor.Enter/Exit! |
1953 | if (_parent != null) | 1953 | if (_parent != null) |
1954 | { | 1954 | { |
@@ -1963,7 +1963,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1963 | d.Quaternion ori = d.BodyGetQuaternion(Body); | 1963 | d.Quaternion ori = d.BodyGetQuaternion(Body); |
1964 | d.Vector3 vel = d.BodyGetLinearVel(Body); | 1964 | d.Vector3 vel = d.BodyGetLinearVel(Body); |
1965 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); | 1965 | d.Vector3 rotvel = d.BodyGetAngularVel(Body); |
1966 | 1966 | ||
1967 | PhysicsVector l_position = new PhysicsVector(); | 1967 | PhysicsVector l_position = new PhysicsVector(); |
1968 | 1968 | ||
1969 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) | 1969 | // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) |
@@ -2000,16 +2000,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2000 | 2000 | ||
2001 | if (l_position.Z < 0) | 2001 | if (l_position.Z < 0) |
2002 | { | 2002 | { |
2003 | // This is so prim that get lost underground don't fall forever and suck up | 2003 | // This is so prim that get lost underground don't fall forever and suck up |
2004 | // | 2004 | // |
2005 | // Sim resources and memory. | 2005 | // Sim resources and memory. |
2006 | // Disables the prim's movement physics.... | 2006 | // Disables the prim's movement physics.... |
2007 | // It's a hack and will generate a console message if it fails. | 2007 | // It's a hack and will generate a console message if it fails. |
2008 | 2008 | ||
2009 | //IsPhysical = false; | 2009 | //IsPhysical = false; |
2010 | if (_parent == null) | 2010 | if (_parent == null) |
2011 | base.RaiseOutOfBounds(_position); | 2011 | base.RaiseOutOfBounds(_position); |
2012 | 2012 | ||
2013 | _acceleration.X = 0; | 2013 | _acceleration.X = 0; |
2014 | _acceleration.Y = 0; | 2014 | _acceleration.Y = 0; |
2015 | _acceleration.Z = 0; | 2015 | _acceleration.Z = 0; |
@@ -2020,10 +2020,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2020 | m_rotationalVelocity.X = 0; | 2020 | m_rotationalVelocity.X = 0; |
2021 | m_rotationalVelocity.Y = 0; | 2021 | m_rotationalVelocity.Y = 0; |
2022 | m_rotationalVelocity.Z = 0; | 2022 | m_rotationalVelocity.Z = 0; |
2023 | 2023 | ||
2024 | if (_parent == null) | 2024 | if (_parent == null) |
2025 | base.RequestPhysicsterseUpdate(); | 2025 | base.RequestPhysicsterseUpdate(); |
2026 | 2026 | ||
2027 | m_throttleUpdates = false; | 2027 | m_throttleUpdates = false; |
2028 | throttleCounter = 0; | 2028 | throttleCounter = 0; |
2029 | _zeroFlag = true; | 2029 | _zeroFlag = true; |
@@ -2065,10 +2065,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2065 | m_throttleUpdates = false; | 2065 | m_throttleUpdates = false; |
2066 | throttleCounter = 0; | 2066 | throttleCounter = 0; |
2067 | m_rotationalVelocity = pv; | 2067 | m_rotationalVelocity = pv; |
2068 | 2068 | ||
2069 | if (_parent == null) | 2069 | if (_parent == null) |
2070 | base.RequestPhysicsterseUpdate(); | 2070 | base.RequestPhysicsterseUpdate(); |
2071 | 2071 | ||
2072 | m_lastUpdateSent = true; | 2072 | m_lastUpdateSent = true; |
2073 | } | 2073 | } |
2074 | } | 2074 | } |
@@ -2087,11 +2087,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2087 | _velocity.X = vel.X; | 2087 | _velocity.X = vel.X; |
2088 | _velocity.Y = vel.Y; | 2088 | _velocity.Y = vel.Y; |
2089 | _velocity.Z = vel.Z; | 2089 | _velocity.Z = vel.Z; |
2090 | 2090 | ||
2091 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); | 2091 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); |
2092 | _acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); | 2092 | _acceleration = new PhysicsVector(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); |
2093 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); | 2093 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); |
2094 | 2094 | ||
2095 | if (_velocity.IsIdentical(pv, 0.5f)) | 2095 | if (_velocity.IsIdentical(pv, 0.5f)) |
2096 | { | 2096 | { |
2097 | m_rotationalVelocity = pv; | 2097 | m_rotationalVelocity = pv; |
@@ -2173,7 +2173,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2173 | { | 2173 | { |
2174 | m_tensor = 5f; | 2174 | m_tensor = 5f; |
2175 | } | 2175 | } |
2176 | 2176 | ||
2177 | float axisnum = 3; | 2177 | float axisnum = 3; |
2178 | 2178 | ||
2179 | axisnum = (axisnum - (axis.X + axis.Y + axis.Z)); | 2179 | axisnum = (axisnum - (axis.X + axis.Y + axis.Z)); |
@@ -2222,7 +2222,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2222 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f); | 2222 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.000000000001f); |
2223 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f); | 2223 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0.000000000001f); |
2224 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f); | 2224 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.000000000001f); |
2225 | 2225 | ||
2226 | d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); | 2226 | d.JointSetAMotorParam(Amotor, (int)dParam.FudgeFactor, 0f); |
2227 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, m_tensor); | 2227 | d.JointSetAMotorParam(Amotor, (int)dParam.FMax, m_tensor); |
2228 | } | 2228 | } |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index d795e45..c663fb0 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -42,7 +42,7 @@ using OpenSim.Region.Physics.Manager; | |||
42 | namespace OpenSim.Region.Physics.OdePlugin | 42 | namespace OpenSim.Region.Physics.OdePlugin |
43 | { | 43 | { |
44 | /// <summary> | 44 | /// <summary> |
45 | /// ODE plugin | 45 | /// ODE plugin |
46 | /// </summary> | 46 | /// </summary> |
47 | public class OdePlugin : IPhysicsPlugin | 47 | public class OdePlugin : IPhysicsPlugin |
48 | { | 48 | { |
@@ -51,7 +51,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
51 | private CollisionLocker ode; | 51 | private CollisionLocker ode; |
52 | private OdeScene _mScene; | 52 | private OdeScene _mScene; |
53 | 53 | ||
54 | |||
55 | public OdePlugin() | 54 | public OdePlugin() |
56 | { | 55 | { |
57 | ode = new CollisionLocker(); | 56 | ode = new CollisionLocker(); |
@@ -81,15 +80,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
81 | } | 80 | } |
82 | } | 81 | } |
83 | 82 | ||
84 | 83 | public enum StatusIndicators : int | |
85 | public enum StatusIndicators : int | ||
86 | { | 84 | { |
87 | Generic = 0, | 85 | Generic = 0, |
88 | Start = 1, | 86 | Start = 1, |
89 | End = 2 | 87 | End = 2 |
90 | } | 88 | } |
91 | 89 | ||
92 | |||
93 | public struct sCollisionData | 90 | public struct sCollisionData |
94 | { | 91 | { |
95 | public uint ColliderLocalId; | 92 | public uint ColliderLocalId; |
@@ -165,7 +162,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
165 | private float mAvatarObjectContactFriction = 75f; | 162 | private float mAvatarObjectContactFriction = 75f; |
166 | private float mAvatarObjectContactBounce = 0.1f; | 163 | private float mAvatarObjectContactBounce = 0.1f; |
167 | 164 | ||
168 | |||
169 | private float avPIDD = 3200f; | 165 | private float avPIDD = 3200f; |
170 | private float avPIDP = 1400f; | 166 | private float avPIDP = 1400f; |
171 | private float avCapRadius = 0.37f; | 167 | private float avCapRadius = 0.37f; |
@@ -175,13 +171,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
175 | private float avMovementDivisorWalk = 1.3f; | 171 | private float avMovementDivisorWalk = 1.3f; |
176 | private float avMovementDivisorRun = 0.8f; | 172 | private float avMovementDivisorRun = 0.8f; |
177 | 173 | ||
178 | |||
179 | private float[] _heightmap; | 174 | private float[] _heightmap; |
180 | 175 | ||
181 | private float[] _watermap; | 176 | private float[] _watermap; |
182 | 177 | ||
183 | private float[] _origheightmap; | 178 | private float[] _origheightmap; |
184 | 179 | ||
185 | private d.NearCallback nearCallback; | 180 | private d.NearCallback nearCallback; |
186 | public d.TriCallback triCallback; | 181 | public d.TriCallback triCallback; |
187 | public d.TriArrayCallback triArrayCallback; | 182 | public d.TriArrayCallback triArrayCallback; |
@@ -200,7 +195,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
200 | private d.Contact AvatarMovementTerrainContact; | 195 | private d.Contact AvatarMovementTerrainContact; |
201 | private d.Contact WaterContact; | 196 | private d.Contact WaterContact; |
202 | 197 | ||
203 | |||
204 | //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it | 198 | //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it |
205 | //Ckrinke private int m_randomizeWater = 200; | 199 | //Ckrinke private int m_randomizeWater = 200; |
206 | private int m_physicsiterations = 10; | 200 | private int m_physicsiterations = 10; |
@@ -233,7 +227,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
233 | 227 | ||
234 | private IConfigSource m_config; | 228 | private IConfigSource m_config; |
235 | 229 | ||
236 | |||
237 | /// <summary> | 230 | /// <summary> |
238 | /// Initiailizes the scene | 231 | /// Initiailizes the scene |
239 | /// Sets many properties that ODE requires to be stable | 232 | /// Sets many properties that ODE requires to be stable |
@@ -245,44 +238,34 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
245 | nearCallback = near; | 238 | nearCallback = near; |
246 | triCallback = TriCallback; | 239 | triCallback = TriCallback; |
247 | triArrayCallback = TriArrayCallback; | 240 | triArrayCallback = TriArrayCallback; |
248 | |||
249 | |||
250 | |||
251 | 241 | ||
252 | lock (OdeLock) | 242 | lock (OdeLock) |
253 | { | 243 | { |
254 | 244 | // Create the world and the first space | |
255 | // Creat the world and the first space | ||
256 | world = d.WorldCreate(); | 245 | world = d.WorldCreate(); |
257 | space = d.HashSpaceCreate(IntPtr.Zero); | 246 | space = d.HashSpaceCreate(IntPtr.Zero); |
258 | 247 | ||
259 | contactgroup = d.JointGroupCreate(0); | 248 | contactgroup = d.JointGroupCreate(0); |
260 | //contactgroup | 249 | //contactgroup |
261 | 250 | ||
262 | |||
263 | |||
264 | |||
265 | d.WorldSetAutoDisableFlag(world, false); | 251 | d.WorldSetAutoDisableFlag(world, false); |
266 | |||
267 | } | 252 | } |
268 | 253 | ||
269 | // zero out a heightmap array float array (single dimention [flattened])) | 254 | // zero out a heightmap array float array (single dimention [flattened])) |
270 | _heightmap = new float[514*514]; | 255 | _heightmap = new float[514*514]; |
271 | _watermap = new float[258 * 258]; | 256 | _watermap = new float[258 * 258]; |
272 | 257 | ||
273 | // Zero out the prim spaces array (we split our space into smaller spaces so | 258 | // Zero out the prim spaces array (we split our space into smaller spaces so |
274 | // we can hit test less. | 259 | // we can hit test less. |
275 | |||
276 | } | 260 | } |
277 | 261 | ||
278 | |||
279 | // Initialize the mesh plugin | 262 | // Initialize the mesh plugin |
280 | public override void Initialise(IMesher meshmerizer, IConfigSource config) | 263 | public override void Initialise(IMesher meshmerizer, IConfigSource config) |
281 | { | 264 | { |
282 | mesher = meshmerizer; | 265 | mesher = meshmerizer; |
283 | m_config = config; | 266 | m_config = config; |
284 | // Defaults | 267 | // Defaults |
285 | 268 | ||
286 | if (Environment.OSVersion.Platform == PlatformID.Unix) | 269 | if (Environment.OSVersion.Platform == PlatformID.Unix) |
287 | { | 270 | { |
288 | avPIDD = 3200.0f; | 271 | avPIDD = 3200.0f; |
@@ -349,10 +332,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
349 | avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", 900.0f); | 332 | avPIDP = physicsconfig.GetFloat("av_pid_proportional_win", 900.0f); |
350 | avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_win", 550000f); | 333 | avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_win", 550000f); |
351 | } | 334 | } |
352 | |||
353 | |||
354 | } | 335 | } |
355 | |||
356 | } | 336 | } |
357 | 337 | ||
358 | staticPrimspace = new IntPtr[(int)(300 / metersInSpace), (int)(300 / metersInSpace)]; | 338 | staticPrimspace = new IntPtr[(int)(300 / metersInSpace), (int)(300 / metersInSpace)]; |
@@ -361,8 +341,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
361 | contact.surface.mu = nmAvatarObjectContactFriction; | 341 | contact.surface.mu = nmAvatarObjectContactFriction; |
362 | contact.surface.bounce = nmAvatarObjectContactBounce; | 342 | contact.surface.bounce = nmAvatarObjectContactBounce; |
363 | 343 | ||
364 | // Terrain contact friction and Bounce | 344 | // Terrain contact friction and Bounce |
365 | // This is the *non* moving version. Use this when an avatar | 345 | // This is the *non* moving version. Use this when an avatar |
366 | // isn't moving to keep it in place better | 346 | // isn't moving to keep it in place better |
367 | TerrainContact.surface.mode |= d.ContactFlags.SoftERP; | 347 | TerrainContact.surface.mode |= d.ContactFlags.SoftERP; |
368 | TerrainContact.surface.mu = nmTerrainContactFriction; | 348 | TerrainContact.surface.mu = nmTerrainContactFriction; |
@@ -376,7 +356,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
376 | WaterContact.surface.soft_erp = 0.010f; | 356 | WaterContact.surface.soft_erp = 0.010f; |
377 | 357 | ||
378 | // Prim contact friction and bounce | 358 | // Prim contact friction and bounce |
379 | // THis is the *non* moving version of friction and bounce | 359 | // THis is the *non* moving version of friction and bounce |
380 | // Use this when an avatar comes in contact with a prim | 360 | // Use this when an avatar comes in contact with a prim |
381 | // and is moving | 361 | // and is moving |
382 | AvatarMovementprimContact.surface.mu = mAvatarObjectContactFriction; | 362 | AvatarMovementprimContact.surface.mu = mAvatarObjectContactFriction; |
@@ -409,7 +389,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
409 | staticPrimspace[i, j] = IntPtr.Zero; | 389 | staticPrimspace[i, j] = IntPtr.Zero; |
410 | } | 390 | } |
411 | } | 391 | } |
412 | |||
413 | } | 392 | } |
414 | 393 | ||
415 | internal void waitForSpaceUnlock(IntPtr space) | 394 | internal void waitForSpaceUnlock(IntPtr space) |
@@ -439,17 +418,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
439 | private void near(IntPtr space, IntPtr g1, IntPtr g2) | 418 | private void near(IntPtr space, IntPtr g1, IntPtr g2) |
440 | { | 419 | { |
441 | // no lock here! It's invoked from within Simulate(), which is thread-locked | 420 | // no lock here! It's invoked from within Simulate(), which is thread-locked |
442 | 421 | ||
443 | // Test if we're collidng a geom with a space. | 422 | // Test if we're colliding a geom with a space. |
444 | // If so we have to drill down into the space recursively | 423 | // If so we have to drill down into the space recursively |
445 | 424 | ||
446 | if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) | 425 | if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) |
447 | { | 426 | { |
448 | if (g1 == (IntPtr)0 || g2 == (IntPtr)0) | 427 | if (g1 == (IntPtr)0 || g2 == (IntPtr)0) |
449 | return; | 428 | return; |
450 | // Separating static prim geometry spaces. | 429 | // Separating static prim geometry spaces. |
451 | // We'll be calling near recursivly if one | 430 | // We'll be calling near recursivly if one |
452 | // of them is a space to find all of the | 431 | // of them is a space to find all of the |
453 | // contact points in the space | 432 | // contact points in the space |
454 | try | 433 | try |
455 | { | 434 | { |
@@ -462,13 +441,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
462 | } | 441 | } |
463 | //Colliding a space or a geom with a space or a geom. so drill down | 442 | //Colliding a space or a geom with a space or a geom. so drill down |
464 | 443 | ||
465 | //Collide all geoms in each space.. | 444 | //Collide all geoms in each space.. |
466 | //if (d.GeomIsSpace(g1)) d.SpaceCollide(g1, IntPtr.Zero, nearCallback); | 445 | //if (d.GeomIsSpace(g1)) d.SpaceCollide(g1, IntPtr.Zero, nearCallback); |
467 | //if (d.GeomIsSpace(g2)) d.SpaceCollide(g2, IntPtr.Zero, nearCallback); | 446 | //if (d.GeomIsSpace(g2)) d.SpaceCollide(g2, IntPtr.Zero, nearCallback); |
468 | return; | 447 | return; |
469 | } | 448 | } |
470 | 449 | ||
471 | |||
472 | if (g1 == (IntPtr)0 || g2 == (IntPtr)0) | 450 | if (g1 == (IntPtr)0 || g2 == (IntPtr)0) |
473 | return; | 451 | return; |
474 | 452 | ||
@@ -499,23 +477,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
499 | int count = 0; | 477 | int count = 0; |
500 | try | 478 | try |
501 | { | 479 | { |
502 | |||
503 | // Colliding Geom To Geom | 480 | // Colliding Geom To Geom |
504 | // This portion of the function 'was' blatantly ripped off from BoxStack.cs | 481 | // This portion of the function 'was' blatantly ripped off from BoxStack.cs |
505 | |||
506 | |||
507 | |||
508 | 482 | ||
509 | if (g1 == g2) | 483 | if (g1 == g2) |
510 | return; // Can't collide with yourself | 484 | return; // Can't collide with yourself |
511 | 485 | ||
512 | if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) | 486 | if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) |
513 | return; | 487 | return; |
514 | 488 | ||
515 | lock (contacts) | 489 | lock (contacts) |
516 | { | 490 | { |
517 | |||
518 | |||
519 | count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); | 491 | count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); |
520 | } | 492 | } |
521 | } | 493 | } |
@@ -527,7 +499,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
527 | } | 499 | } |
528 | catch (AccessViolationException) | 500 | catch (AccessViolationException) |
529 | { | 501 | { |
530 | 502 | ||
531 | m_log.Warn("[PHYSICS]: Unable to collide test an object"); | 503 | m_log.Warn("[PHYSICS]: Unable to collide test an object"); |
532 | return; | 504 | return; |
533 | } | 505 | } |
@@ -539,6 +511,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
539 | { | 511 | { |
540 | p1 = PANull; | 512 | p1 = PANull; |
541 | } | 513 | } |
514 | |||
542 | if (!actor_name_map.TryGetValue(g2, out p2)) | 515 | if (!actor_name_map.TryGetValue(g2, out p2)) |
543 | { | 516 | { |
544 | p2 = PANull; | 517 | p2 = PANull; |
@@ -554,14 +527,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
554 | // If we're colliding with terrain, use 'TerrainContact' instead of contact. | 527 | // If we're colliding with terrain, use 'TerrainContact' instead of contact. |
555 | // allows us to have different settings | 528 | // allows us to have different settings |
556 | 529 | ||
557 | |||
558 | |||
559 | // We only need to test p2 for 'jump crouch purposes' | 530 | // We only need to test p2 for 'jump crouch purposes' |
560 | p2.IsColliding = true; | 531 | p2.IsColliding = true; |
561 | 532 | ||
562 | //if ((framecount % m_returncollisions) == 0) | 533 | //if ((framecount % m_returncollisions) == 0) |
563 | |||
564 | |||
565 | 534 | ||
566 | switch (p1.PhysicsActorType) | 535 | switch (p1.PhysicsActorType) |
567 | { | 536 | { |
@@ -588,41 +557,39 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
588 | { | 557 | { |
589 | //This is disabled at the moment only because it needs more tweaking | 558 | //This is disabled at the moment only because it needs more tweaking |
590 | //It will eventually be uncommented | 559 | //It will eventually be uncommented |
591 | 560 | ||
592 | if (contacts[i].depth >= 1.00f) | 561 | if (contacts[i].depth >= 1.00f) |
593 | { | 562 | { |
594 | //m_log.Debug("[PHYSICS]: " + contacts[i].depth.ToString()); | 563 | //m_log.Debug("[PHYSICS]: " + contacts[i].depth.ToString()); |
595 | } | 564 | } |
596 | 565 | ||
597 | //If you interpenetrate a prim with an agent | 566 | //If you interpenetrate a prim with an agent |
598 | if ((p2.PhysicsActorType == (int) ActorTypes.Agent && | 567 | if ((p2.PhysicsActorType == (int) ActorTypes.Agent && |
599 | p1.PhysicsActorType == (int) ActorTypes.Prim) || | 568 | p1.PhysicsActorType == (int) ActorTypes.Prim) || |
600 | (p1.PhysicsActorType == (int) ActorTypes.Agent && | 569 | (p1.PhysicsActorType == (int) ActorTypes.Agent && |
601 | p2.PhysicsActorType == (int) ActorTypes.Prim)) | 570 | p2.PhysicsActorType == (int) ActorTypes.Prim)) |
602 | { | 571 | { |
603 | |||
604 | |||
605 | # region disabled code1 | 572 | # region disabled code1 |
606 | //contacts[i].depth = contacts[i].depth * 4.15f; | 573 | //contacts[i].depth = contacts[i].depth * 4.15f; |
607 | /* | 574 | /* |
608 | if (p2.PhysicsActorType == (int) ActorTypes.Agent) | 575 | if (p2.PhysicsActorType == (int) ActorTypes.Agent) |
609 | { | 576 | { |
610 | p2.CollidingObj = true; | 577 | p2.CollidingObj = true; |
611 | contacts[i].depth = 0.003f; | 578 | contacts[i].depth = 0.003f; |
612 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); | 579 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); |
613 | OdeCharacter character = (OdeCharacter) p2; | 580 | OdeCharacter character = (OdeCharacter) p2; |
614 | character.SetPidStatus(true); | 581 | character.SetPidStatus(true); |
615 | contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); | 582 | contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); |
616 | 583 | ||
617 | } | 584 | } |
618 | else | 585 | else |
619 | { | 586 | { |
620 | 587 | ||
621 | //contacts[i].depth = 0.0000000f; | 588 | //contacts[i].depth = 0.0000000f; |
622 | } | 589 | } |
623 | if (p1.PhysicsActorType == (int) ActorTypes.Agent) | 590 | if (p1.PhysicsActorType == (int) ActorTypes.Agent) |
624 | { | 591 | { |
625 | 592 | ||
626 | p1.CollidingObj = true; | 593 | p1.CollidingObj = true; |
627 | contacts[i].depth = 0.003f; | 594 | contacts[i].depth = 0.003f; |
628 | p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); | 595 | p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); |
@@ -632,14 +599,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
632 | } | 599 | } |
633 | else | 600 | else |
634 | { | 601 | { |
635 | 602 | ||
636 | //contacts[i].depth = 0.0000000f; | 603 | //contacts[i].depth = 0.0000000f; |
637 | } | 604 | } |
638 | */ | 605 | */ |
639 | #endregion | 606 | #endregion |
640 | |||
641 | } | 607 | } |
642 | |||
643 | 608 | ||
644 | // If you interpenetrate a prim with another prim | 609 | // If you interpenetrate a prim with another prim |
645 | if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) | 610 | if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) |
@@ -649,7 +614,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
649 | //OdePrim op2 = (OdePrim)p2; | 614 | //OdePrim op2 = (OdePrim)p2; |
650 | //op1.m_collisionscore++; | 615 | //op1.m_collisionscore++; |
651 | //op2.m_collisionscore++; | 616 | //op2.m_collisionscore++; |
652 | |||
653 | 617 | ||
654 | //if (op1.m_collisionscore > 8000 || op2.m_collisionscore > 8000) | 618 | //if (op1.m_collisionscore > 8000 || op2.m_collisionscore > 8000) |
655 | //{ | 619 | //{ |
@@ -658,11 +622,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
658 | //op2.m_taintdisable = true; | 622 | //op2.m_taintdisable = true; |
659 | //AddPhysicsActorTaint(p2); | 623 | //AddPhysicsActorTaint(p2); |
660 | //} | 624 | //} |
661 | 625 | ||
662 | //if (contacts[i].depth >= 0.25f) | 626 | //if (contacts[i].depth >= 0.25f) |
663 | //{ | 627 | //{ |
664 | // Don't collide, one or both prim will expld. | 628 | // Don't collide, one or both prim will expld. |
665 | |||
666 | 629 | ||
667 | //op1.m_interpenetrationcount++; | 630 | //op1.m_interpenetrationcount++; |
668 | //op2.m_interpenetrationcount++; | 631 | //op2.m_interpenetrationcount++; |
@@ -678,17 +641,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
678 | //AddPhysicsActorTaint(p2); | 641 | //AddPhysicsActorTaint(p2); |
679 | //} | 642 | //} |
680 | 643 | ||
681 | |||
682 | //contacts[i].depth = contacts[i].depth / 8f; | 644 | //contacts[i].depth = contacts[i].depth / 8f; |
683 | //contacts[i].normal = new d.Vector3(0, 0, 1); | 645 | //contacts[i].normal = new d.Vector3(0, 0, 1); |
684 | //} | 646 | //} |
685 | //if (op1.m_disabled || op2.m_disabled) | 647 | //if (op1.m_disabled || op2.m_disabled) |
686 | //{ | 648 | //{ |
687 | //Manually disabled objects stay disabled | 649 | //Manually disabled objects stay disabled |
688 | //contacts[i].depth = 0f; | 650 | //contacts[i].depth = 0f; |
689 | //} | 651 | //} |
690 | #endregion | 652 | #endregion |
691 | } | 653 | } |
654 | |||
692 | if (contacts[i].depth >= 1.00f) | 655 | if (contacts[i].depth >= 1.00f) |
693 | { | 656 | { |
694 | //m_log.Info("[P]: " + contacts[i].depth.ToString()); | 657 | //m_log.Info("[P]: " + contacts[i].depth.ToString()); |
@@ -713,6 +676,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
713 | else | 676 | else |
714 | { | 677 | { |
715 | } | 678 | } |
679 | |||
716 | if (p1.PhysicsActorType == (int) ActorTypes.Agent) | 680 | if (p1.PhysicsActorType == (int) ActorTypes.Agent) |
717 | { | 681 | { |
718 | OdeCharacter character = (OdeCharacter)p1; | 682 | OdeCharacter character = (OdeCharacter)p1; |
@@ -738,7 +702,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
738 | 702 | ||
739 | if (contacts[i].depth >= 0f) | 703 | if (contacts[i].depth >= 0f) |
740 | { | 704 | { |
741 | // If we're collidng against terrain | 705 | // If we're colliding against terrain |
742 | if (name1 == "Terrain" || name2 == "Terrain") | 706 | if (name1 == "Terrain" || name2 == "Terrain") |
743 | { | 707 | { |
744 | // If we're moving | 708 | // If we're moving |
@@ -760,12 +724,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
760 | { | 724 | { |
761 | if ((p2.PhysicsActorType == (int)ActorTypes.Prim)) | 725 | if ((p2.PhysicsActorType == (int)ActorTypes.Prim)) |
762 | { | 726 | { |
763 | |||
764 | } | 727 | } |
765 | else | 728 | else |
766 | { | 729 | { |
767 | |||
768 | } | 730 | } |
731 | |||
769 | //WaterContact.surface.soft_cfm = 0.0000f; | 732 | //WaterContact.surface.soft_cfm = 0.0000f; |
770 | //WaterContact.surface.soft_erp = 0.00000f; | 733 | //WaterContact.surface.soft_erp = 0.00000f; |
771 | if (contacts[i].depth > 0.1f) | 734 | if (contacts[i].depth > 0.1f) |
@@ -775,7 +738,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
775 | //contacts[i].pos = new d.Vector3(0, 0, contacts[i].pos.Z - 5f); | 738 | //contacts[i].pos = new d.Vector3(0, 0, contacts[i].pos.Z - 5f); |
776 | } | 739 | } |
777 | WaterContact.geom = contacts[i]; | 740 | WaterContact.geom = contacts[i]; |
778 | 741 | ||
779 | joint = d.JointCreateContact(world, contactgroup, ref WaterContact); | 742 | joint = d.JointCreateContact(world, contactgroup, ref WaterContact); |
780 | 743 | ||
781 | //m_log.Info("[PHYSICS]: Prim Water Contact" + contacts[i].depth); | 744 | //m_log.Info("[PHYSICS]: Prim Water Contact" + contacts[i].depth); |
@@ -806,7 +769,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
806 | { | 769 | { |
807 | // If there are more then 3 contact points, it's likely | 770 | // If there are more then 3 contact points, it's likely |
808 | // that we've got a pile of objects | 771 | // that we've got a pile of objects |
809 | // | 772 | // |
810 | // We don't want to send out hundreds of terse updates over and over again | 773 | // We don't want to send out hundreds of terse updates over and over again |
811 | // so lets throttle them and send them again after it's somewhat sorted out. | 774 | // so lets throttle them and send them again after it's somewhat sorted out. |
812 | p2.ThrottleUpdates = true; | 775 | p2.ThrottleUpdates = true; |
@@ -814,7 +777,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
814 | //System.Console.WriteLine(count.ToString()); | 777 | //System.Console.WriteLine(count.ToString()); |
815 | //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); | 778 | //System.Console.WriteLine("near: A collision was detected between {1} and {2}", 0, name1, name2); |
816 | } | 779 | } |
817 | |||
818 | } | 780 | } |
819 | 781 | ||
820 | private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, float collisiondepth) | 782 | private void collision_accounting_events(PhysicsActor p1, PhysicsActor p2, float collisiondepth) |
@@ -831,7 +793,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
831 | { | 793 | { |
832 | case ActorTypes.Agent: | 794 | case ActorTypes.Agent: |
833 | cc2 = (OdeCharacter)p2; | 795 | cc2 = (OdeCharacter)p2; |
834 | 796 | ||
835 | obj1LocalID = cc2.m_localID; | 797 | obj1LocalID = cc2.m_localID; |
836 | switch ((ActorTypes)p1.PhysicsActorType) | 798 | switch ((ActorTypes)p1.PhysicsActorType) |
837 | { | 799 | { |
@@ -840,7 +802,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
840 | obj2LocalID = cc1.m_localID; | 802 | obj2LocalID = cc1.m_localID; |
841 | cc1.AddCollisionEvent(cc2.m_localID, collisiondepth); | 803 | cc1.AddCollisionEvent(cc2.m_localID, collisiondepth); |
842 | //ctype = (int)CollisionCategories.Character; | 804 | //ctype = (int)CollisionCategories.Character; |
843 | 805 | ||
844 | //if (cc1.CollidingObj) | 806 | //if (cc1.CollidingObj) |
845 | //cStartStop = (int)StatusIndicators.Generic; | 807 | //cStartStop = (int)StatusIndicators.Generic; |
846 | //else | 808 | //else |
@@ -858,7 +820,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
858 | //cStartStop = (int)StatusIndicators.Generic; | 820 | //cStartStop = (int)StatusIndicators.Generic; |
859 | //else | 821 | //else |
860 | //cStartStop = (int)StatusIndicators.Start; | 822 | //cStartStop = (int)StatusIndicators.Start; |
861 | 823 | ||
862 | //returncollisions = true; | 824 | //returncollisions = true; |
863 | break; | 825 | break; |
864 | 826 | ||
@@ -869,14 +831,12 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
869 | //returncollisions = true; | 831 | //returncollisions = true; |
870 | break; | 832 | break; |
871 | } | 833 | } |
872 | |||
873 | 834 | ||
874 | |||
875 | cc2.AddCollisionEvent(obj2LocalID, collisiondepth); | 835 | cc2.AddCollisionEvent(obj2LocalID, collisiondepth); |
876 | break; | 836 | break; |
877 | case ActorTypes.Prim: | 837 | case ActorTypes.Prim: |
878 | cp2 = (OdePrim)p2; | 838 | cp2 = (OdePrim)p2; |
879 | 839 | ||
880 | obj1LocalID = cp2.m_localID; | 840 | obj1LocalID = cp2.m_localID; |
881 | switch ((ActorTypes)p1.PhysicsActorType) | 841 | switch ((ActorTypes)p1.PhysicsActorType) |
882 | { | 842 | { |
@@ -891,7 +851,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
891 | //else | 851 | //else |
892 | //cStartStop = (int)StatusIndicators.Start; | 852 | //cStartStop = (int)StatusIndicators.Start; |
893 | //returncollisions = true; | 853 | //returncollisions = true; |
894 | 854 | ||
895 | break; | 855 | break; |
896 | case ActorTypes.Prim: | 856 | case ActorTypes.Prim: |
897 | cp1 = (OdePrim)p1; | 857 | cp1 = (OdePrim)p1; |
@@ -903,7 +863,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
903 | //cStartStop = (int)StatusIndicators.Generic; | 863 | //cStartStop = (int)StatusIndicators.Generic; |
904 | //else | 864 | //else |
905 | //cStartStop = (int)StatusIndicators.Start; | 865 | //cStartStop = (int)StatusIndicators.Start; |
906 | 866 | ||
907 | //returncollisions = true; | 867 | //returncollisions = true; |
908 | break; | 868 | break; |
909 | 869 | ||
@@ -911,11 +871,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
911 | case ActorTypes.Unknown: | 871 | case ActorTypes.Unknown: |
912 | obj2LocalID = 0; | 872 | obj2LocalID = 0; |
913 | //ctype = (int)CollisionCategories.Land; | 873 | //ctype = (int)CollisionCategories.Land; |
914 | 874 | ||
915 | //returncollisions = true; | 875 | //returncollisions = true; |
916 | break; | 876 | break; |
917 | } | 877 | } |
918 | 878 | ||
919 | cp2.AddCollisionEvent(obj2LocalID, collisiondepth); | 879 | cp2.AddCollisionEvent(obj2LocalID, collisiondepth); |
920 | break; | 880 | break; |
921 | } | 881 | } |
@@ -999,7 +959,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
999 | /// <param name="timeStep"></param> | 959 | /// <param name="timeStep"></param> |
1000 | private void collision_optimized(float timeStep) | 960 | private void collision_optimized(float timeStep) |
1001 | { | 961 | { |
1002 | 962 | ||
1003 | foreach (OdeCharacter chr in _characters) | 963 | foreach (OdeCharacter chr in _characters) |
1004 | { | 964 | { |
1005 | // Reset the collision values to false | 965 | // Reset the collision values to false |
@@ -1008,7 +968,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1008 | chr.IsColliding = false; | 968 | chr.IsColliding = false; |
1009 | chr.CollidingGround = false; | 969 | chr.CollidingGround = false; |
1010 | chr.CollidingObj = false; | 970 | chr.CollidingObj = false; |
1011 | 971 | ||
1012 | // test the avatar's geometry for collision with the space | 972 | // test the avatar's geometry for collision with the space |
1013 | // This will return near and the space that they are the closest to | 973 | // This will return near and the space that they are the closest to |
1014 | // And we'll run this again against the avatar and the space segment | 974 | // And we'll run this again against the avatar and the space segment |
@@ -1029,15 +989,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1029 | //forcedZ = true; | 989 | //forcedZ = true; |
1030 | //} | 990 | //} |
1031 | } | 991 | } |
1032 | |||
1033 | 992 | ||
1034 | |||
1035 | lock (_activeprims) | 993 | lock (_activeprims) |
1036 | { | 994 | { |
1037 | |||
1038 | foreach (OdePrim chr in _activeprims) | 995 | foreach (OdePrim chr in _activeprims) |
1039 | { | 996 | { |
1040 | |||
1041 | if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled)) | 997 | if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled)) |
1042 | { | 998 | { |
1043 | try | 999 | try |
@@ -1049,18 +1005,14 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1049 | else | 1005 | else |
1050 | m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed"); | 1006 | m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed"); |
1051 | } | 1007 | } |
1052 | |||
1053 | } | 1008 | } |
1054 | catch (AccessViolationException) | 1009 | catch (AccessViolationException) |
1055 | { | 1010 | { |
1056 | m_log.Warn("[PHYSICS]: Unable to space collide"); | 1011 | m_log.Warn("[PHYSICS]: Unable to space collide"); |
1057 | } | 1012 | } |
1058 | |||
1059 | } | 1013 | } |
1060 | |||
1061 | } | 1014 | } |
1062 | } | 1015 | } |
1063 | |||
1064 | } | 1016 | } |
1065 | 1017 | ||
1066 | #endregion | 1018 | #endregion |
@@ -1077,7 +1029,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1077 | { | 1029 | { |
1078 | if (!_collisionEventPrim.Contains(obj)) | 1030 | if (!_collisionEventPrim.Contains(obj)) |
1079 | _collisionEventPrim.Add(obj); | 1031 | _collisionEventPrim.Add(obj); |
1080 | |||
1081 | } | 1032 | } |
1082 | } | 1033 | } |
1083 | 1034 | ||
@@ -1090,7 +1041,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1090 | } | 1041 | } |
1091 | } | 1042 | } |
1092 | 1043 | ||
1093 | |||
1094 | #region Add/Remove Entities | 1044 | #region Add/Remove Entities |
1095 | 1045 | ||
1096 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) | 1046 | public override PhysicsActor AddAvatar(string avName, PhysicsVector position, PhysicsVector size) |
@@ -1131,8 +1081,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1131 | rot.y = rotation.y; | 1081 | rot.y = rotation.y; |
1132 | rot.z = rotation.z; | 1082 | rot.z = rotation.z; |
1133 | 1083 | ||
1134 | |||
1135 | |||
1136 | OdePrim newPrim; | 1084 | OdePrim newPrim; |
1137 | lock (OdeLock) | 1085 | lock (OdeLock) |
1138 | { | 1086 | { |
@@ -1141,7 +1089,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1141 | _prims.Add(newPrim); | 1089 | _prims.Add(newPrim); |
1142 | } | 1090 | } |
1143 | 1091 | ||
1144 | |||
1145 | return newPrim; | 1092 | return newPrim; |
1146 | } | 1093 | } |
1147 | 1094 | ||
@@ -1178,11 +1125,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1178 | 1125 | ||
1179 | result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); | 1126 | result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical); |
1180 | 1127 | ||
1181 | |||
1182 | return result; | 1128 | return result; |
1183 | } | 1129 | } |
1184 | 1130 | ||
1185 | |||
1186 | public void remActivePrim(OdePrim deactivatePrim) | 1131 | public void remActivePrim(OdePrim deactivatePrim) |
1187 | { | 1132 | { |
1188 | lock (_activeprims) | 1133 | lock (_activeprims) |
@@ -1210,8 +1155,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1210 | /// This is called from within simulate but outside the locked portion | 1155 | /// This is called from within simulate but outside the locked portion |
1211 | /// We need to do our own locking here | 1156 | /// We need to do our own locking here |
1212 | /// Essentially, we need to remove the prim from our space segment, whatever segment it's in. | 1157 | /// Essentially, we need to remove the prim from our space segment, whatever segment it's in. |
1213 | /// | 1158 | /// |
1214 | /// If there are no more prim in the segment, we need to empty (spacedestroy)the segment and reclaim memory | 1159 | /// If there are no more prim in the segment, we need to empty (spacedestroy)the segment and reclaim memory |
1215 | /// that the space was using. | 1160 | /// that the space was using. |
1216 | /// </summary> | 1161 | /// </summary> |
1217 | /// <param name="prim"></param> | 1162 | /// <param name="prim"></param> |
@@ -1226,7 +1171,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1226 | { | 1171 | { |
1227 | prim.ResetTaints(); | 1172 | prim.ResetTaints(); |
1228 | 1173 | ||
1229 | |||
1230 | if (prim.IsPhysical) | 1174 | if (prim.IsPhysical) |
1231 | { | 1175 | { |
1232 | prim.disableBody(); | 1176 | prim.disableBody(); |
@@ -1267,7 +1211,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1267 | { | 1211 | { |
1268 | m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene"); | 1212 | m_log.Warn("[PHYSICS]: Unable to remove prim from physics scene"); |
1269 | } | 1213 | } |
1270 | |||
1271 | } | 1214 | } |
1272 | catch (AccessViolationException) | 1215 | catch (AccessViolationException) |
1273 | { | 1216 | { |
@@ -1297,8 +1240,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1297 | //} | 1240 | //} |
1298 | //} | 1241 | //} |
1299 | } | 1242 | } |
1300 | |||
1301 | |||
1302 | } | 1243 | } |
1303 | } | 1244 | } |
1304 | } | 1245 | } |
@@ -1337,12 +1278,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1337 | /// <returns>a pointer to the new space it's in</returns> | 1278 | /// <returns>a pointer to the new space it's in</returns> |
1338 | public IntPtr recalculateSpaceForGeom(IntPtr geom, PhysicsVector pos, IntPtr currentspace) | 1279 | public IntPtr recalculateSpaceForGeom(IntPtr geom, PhysicsVector pos, IntPtr currentspace) |
1339 | { | 1280 | { |
1340 | 1281 | // Called from setting the Position and Size of an ODEPrim so | |
1341 | // Called from setting the Position and Size of an ODEPrim so | ||
1342 | // it's already in locked space. | 1282 | // it's already in locked space. |
1343 | 1283 | ||
1344 | // we don't want to remove the main space | 1284 | // we don't want to remove the main space |
1345 | // we don't need to test physical here because this function should | 1285 | // we don't need to test physical here because this function should |
1346 | // never be called if the prim is physical(active) | 1286 | // never be called if the prim is physical(active) |
1347 | 1287 | ||
1348 | // All physical prim end up in the root space | 1288 | // All physical prim end up in the root space |
@@ -1399,7 +1339,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1399 | waitForSpaceUnlock(space); | 1339 | waitForSpaceUnlock(space); |
1400 | d.SpaceRemove(space, currentspace); | 1340 | d.SpaceRemove(space, currentspace); |
1401 | // free up memory used by the space. | 1341 | // free up memory used by the space. |
1402 | 1342 | ||
1403 | //d.SpaceDestroy(currentspace); | 1343 | //d.SpaceDestroy(currentspace); |
1404 | resetSpaceArrayItemToZero(currentspace); | 1344 | resetSpaceArrayItemToZero(currentspace); |
1405 | } | 1345 | } |
@@ -1418,7 +1358,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1418 | { | 1358 | { |
1419 | if (d.SpaceQuery(currentspace, geom)) | 1359 | if (d.SpaceQuery(currentspace, geom)) |
1420 | { | 1360 | { |
1421 | |||
1422 | if (d.GeomIsSpace(currentspace)) | 1361 | if (d.GeomIsSpace(currentspace)) |
1423 | { | 1362 | { |
1424 | waitForSpaceUnlock(currentspace); | 1363 | waitForSpaceUnlock(currentspace); |
@@ -1453,8 +1392,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1453 | } | 1392 | } |
1454 | } | 1393 | } |
1455 | 1394 | ||
1456 | // The routines in the Position and Size sections do the 'inserting' into the space, | 1395 | // The routines in the Position and Size sections do the 'inserting' into the space, |
1457 | // so all we have to do is make sure that the space that we're putting the prim into | 1396 | // so all we have to do is make sure that the space that we're putting the prim into |
1458 | // is in the 'main' space. | 1397 | // is in the 'main' space. |
1459 | int[] iprimspaceArrItem = calculateSpaceArrayItemFromPos(pos); | 1398 | int[] iprimspaceArrItem = calculateSpaceArrayItemFromPos(pos); |
1460 | IntPtr newspace = calculateSpaceForGeom(pos); | 1399 | IntPtr newspace = calculateSpaceForGeom(pos); |
@@ -1492,11 +1431,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1492 | public IntPtr calculateSpaceForGeom(PhysicsVector pos) | 1431 | public IntPtr calculateSpaceForGeom(PhysicsVector pos) |
1493 | { | 1432 | { |
1494 | IntPtr locationbasedspace =IntPtr.Zero; | 1433 | IntPtr locationbasedspace =IntPtr.Zero; |
1495 | 1434 | ||
1496 | int[] xyspace = calculateSpaceArrayItemFromPos(pos); | 1435 | int[] xyspace = calculateSpaceArrayItemFromPos(pos); |
1497 | //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); | 1436 | //m_log.Info("[Physics]: Attempting to use arrayItem: " + xyspace[0].ToString() + "," + xyspace[1].ToString()); |
1498 | locationbasedspace = staticPrimspace[xyspace[0], xyspace[1]]; | 1437 | locationbasedspace = staticPrimspace[xyspace[0], xyspace[1]]; |
1499 | 1438 | ||
1500 | //locationbasedspace = space; | 1439 | //locationbasedspace = space; |
1501 | return locationbasedspace; | 1440 | return locationbasedspace; |
1502 | } | 1441 | } |
@@ -1523,13 +1462,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1523 | if (returnint[1] < 0) | 1462 | if (returnint[1] < 0) |
1524 | returnint[1] = 0; | 1463 | returnint[1] = 0; |
1525 | 1464 | ||
1526 | |||
1527 | return returnint; | 1465 | return returnint; |
1528 | } | 1466 | } |
1529 | #endregion | ||
1530 | |||
1531 | |||
1532 | 1467 | ||
1468 | #endregion | ||
1533 | 1469 | ||
1534 | /// <summary> | 1470 | /// <summary> |
1535 | /// Routine to figure out if we need to mesh this prim with our mesher | 1471 | /// Routine to figure out if we need to mesh this prim with our mesher |
@@ -1564,7 +1500,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1564 | return false; | 1500 | return false; |
1565 | } | 1501 | } |
1566 | 1502 | ||
1567 | |||
1568 | /// <summary> | 1503 | /// <summary> |
1569 | /// Called after our prim properties are set Scale, position etc. | 1504 | /// Called after our prim properties are set Scale, position etc. |
1570 | /// We use this event queue like method to keep changes to the physical scene occuring in the threadlocked mutex | 1505 | /// We use this event queue like method to keep changes to the physical scene occuring in the threadlocked mutex |
@@ -1586,7 +1521,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1586 | 1521 | ||
1587 | /// <summary> | 1522 | /// <summary> |
1588 | /// This is our main simulate loop | 1523 | /// This is our main simulate loop |
1589 | /// It's thread locked by a Mutex in the scene. | 1524 | /// It's thread locked by a Mutex in the scene. |
1590 | /// It holds Collisions, it instructs ODE to step through the physical reactions | 1525 | /// It holds Collisions, it instructs ODE to step through the physical reactions |
1591 | /// It moves the objects around in memory | 1526 | /// It moves the objects around in memory |
1592 | /// It calls the methods that report back to the object owners.. (scenepresence, SceneObjectGroup) | 1527 | /// It calls the methods that report back to the object owners.. (scenepresence, SceneObjectGroup) |
@@ -1597,7 +1532,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1597 | { | 1532 | { |
1598 | if (framecount >= int.MaxValue) | 1533 | if (framecount >= int.MaxValue) |
1599 | framecount = 0; | 1534 | framecount = 0; |
1600 | 1535 | ||
1601 | framecount++; | 1536 | framecount++; |
1602 | 1537 | ||
1603 | float fps = 0; | 1538 | float fps = 0; |
@@ -1605,12 +1540,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1605 | step_time += timeStep; | 1540 | step_time += timeStep; |
1606 | 1541 | ||
1607 | 1542 | ||
1608 | // If We're loaded down by something else, | 1543 | // If We're loaded down by something else, |
1609 | // or debugging with the Visual Studio project on pause | 1544 | // or debugging with the Visual Studio project on pause |
1610 | // skip a few frames to catch up gracefully. | 1545 | // skip a few frames to catch up gracefully. |
1611 | // without shooting the physicsactors all over the place | 1546 | // without shooting the physicsactors all over the place |
1612 | 1547 | ||
1613 | |||
1614 | if (step_time >= m_SkipFramesAtms) | 1548 | if (step_time >= m_SkipFramesAtms) |
1615 | { | 1549 | { |
1616 | // Instead of trying to catch up, it'll do 5 physics frames only | 1550 | // Instead of trying to catch up, it'll do 5 physics frames only |
@@ -1623,7 +1557,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1623 | } | 1557 | } |
1624 | lock (OdeLock) | 1558 | lock (OdeLock) |
1625 | { | 1559 | { |
1626 | // Process 10 frames if the sim is running normal.. | 1560 | // Process 10 frames if the sim is running normal.. |
1627 | // process 5 frames if the sim is running slow | 1561 | // process 5 frames if the sim is running slow |
1628 | //try | 1562 | //try |
1629 | //{ | 1563 | //{ |
@@ -1642,13 +1576,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1642 | //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size | 1576 | //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size |
1643 | step_time = 0.09375f; | 1577 | step_time = 0.09375f; |
1644 | fps = (step_time/ODE_STEPSIZE) * 1000; | 1578 | fps = (step_time/ODE_STEPSIZE) * 1000; |
1645 | 1579 | ||
1646 | while (step_time > 0.0f) | 1580 | while (step_time > 0.0f) |
1647 | { | 1581 | { |
1648 | //lock (ode) | 1582 | //lock (ode) |
1649 | //{ | 1583 | //{ |
1650 | //if (!ode.lockquery()) | 1584 | //if (!ode.lockquery()) |
1651 | //{ | 1585 | //{ |
1652 | // ode.dlock(world); | 1586 | // ode.dlock(world); |
1653 | try | 1587 | try |
1654 | { | 1588 | { |
@@ -1661,9 +1595,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1661 | } | 1595 | } |
1662 | } | 1596 | } |
1663 | 1597 | ||
1664 | |||
1665 | bool processedtaints = false; | 1598 | bool processedtaints = false; |
1666 | 1599 | ||
1667 | lock (_taintedPrim) | 1600 | lock (_taintedPrim) |
1668 | { | 1601 | { |
1669 | foreach (OdePrim prim in _taintedPrim) | 1602 | foreach (OdePrim prim in _taintedPrim) |
@@ -1679,10 +1612,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1679 | processedtaints = true; | 1612 | processedtaints = true; |
1680 | prim.m_collisionscore = 0; | 1613 | prim.m_collisionscore = 0; |
1681 | } | 1614 | } |
1682 | 1615 | ||
1683 | if (processedtaints) | 1616 | if (processedtaints) |
1684 | _taintedPrim = new List<OdePrim>(); | 1617 | _taintedPrim = new List<OdePrim>(); |
1685 | |||
1686 | } | 1618 | } |
1687 | 1619 | ||
1688 | lock (_activeprims) | 1620 | lock (_activeprims) |
@@ -1696,7 +1628,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1696 | 1628 | ||
1697 | //if ((framecount % m_randomizeWater) == 0) | 1629 | //if ((framecount % m_randomizeWater) == 0) |
1698 | // randomizeWater(waterlevel); | 1630 | // randomizeWater(waterlevel); |
1699 | |||
1700 | 1631 | ||
1701 | collision_optimized(timeStep); | 1632 | collision_optimized(timeStep); |
1702 | 1633 | ||
@@ -1718,7 +1649,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1718 | pobj.SendCollisions(); | 1649 | pobj.SendCollisions(); |
1719 | break; | 1650 | break; |
1720 | } | 1651 | } |
1721 | |||
1722 | } | 1652 | } |
1723 | } | 1653 | } |
1724 | 1654 | ||
@@ -1726,13 +1656,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1726 | 1656 | ||
1727 | d.JointGroupEmpty(contactgroup); | 1657 | d.JointGroupEmpty(contactgroup); |
1728 | //ode.dunlock(world); | 1658 | //ode.dunlock(world); |
1729 | } | 1659 | } |
1730 | catch (Exception e) | 1660 | catch (Exception e) |
1731 | { | 1661 | { |
1732 | m_log.Error("[PHYSICS]: " + e.Message.ToString() + e.TargetSite.ToString()); | 1662 | m_log.Error("[PHYSICS]: " + e.Message.ToString() + e.TargetSite.ToString()); |
1733 | ode.dunlock(world); | 1663 | ode.dunlock(world); |
1734 | } | 1664 | } |
1735 | 1665 | ||
1736 | step_time -= ODE_STEPSIZE; | 1666 | step_time -= ODE_STEPSIZE; |
1737 | i++; | 1667 | i++; |
1738 | //} | 1668 | //} |
@@ -1765,7 +1695,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1765 | } | 1695 | } |
1766 | } | 1696 | } |
1767 | } | 1697 | } |
1768 | |||
1769 | } | 1698 | } |
1770 | return fps; | 1699 | return fps; |
1771 | } | 1700 | } |
@@ -1780,7 +1709,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1780 | get { return (false); } | 1709 | get { return (false); } |
1781 | } | 1710 | } |
1782 | 1711 | ||
1783 | #region ODE Specific Terrain Fixes | 1712 | #region ODE Specific Terrain Fixes |
1784 | public float[] ResizeTerrain512NearestNeighbour(float[] heightMap) | 1713 | public float[] ResizeTerrain512NearestNeighbour(float[] heightMap) |
1785 | { | 1714 | { |
1786 | float[] returnarr = new float[262144]; | 1715 | float[] returnarr = new float[262144]; |
@@ -1800,7 +1729,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1800 | // This particular way is quick but it only works on a multiple of the original | 1729 | // This particular way is quick but it only works on a multiple of the original |
1801 | 1730 | ||
1802 | // The idea behind this method can be described with the following diagrams | 1731 | // The idea behind this method can be described with the following diagrams |
1803 | // second pass and third pass happen in the same loop really.. just separated | 1732 | // second pass and third pass happen in the same loop really.. just separated |
1804 | // them to show what this does. | 1733 | // them to show what this does. |
1805 | 1734 | ||
1806 | // First Pass | 1735 | // First Pass |
@@ -1893,6 +1822,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1893 | 1822 | ||
1894 | return returnarr; | 1823 | return returnarr; |
1895 | } | 1824 | } |
1825 | |||
1896 | public float[] ResizeTerrain512Interpolation(float[] heightMap) | 1826 | public float[] ResizeTerrain512Interpolation(float[] heightMap) |
1897 | { | 1827 | { |
1898 | float[] returnarr = new float[262144]; | 1828 | float[] returnarr = new float[262144]; |
@@ -1912,7 +1842,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1912 | // This particular way is quick but it only works on a multiple of the original | 1842 | // This particular way is quick but it only works on a multiple of the original |
1913 | 1843 | ||
1914 | // The idea behind this method can be described with the following diagrams | 1844 | // The idea behind this method can be described with the following diagrams |
1915 | // second pass and third pass happen in the same loop really.. just separated | 1845 | // second pass and third pass happen in the same loop really.. just separated |
1916 | // them to show what this does. | 1846 | // them to show what this does. |
1917 | 1847 | ||
1918 | // First Pass | 1848 | // First Pass |
@@ -2139,7 +2069,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2139 | // m_log.Info((baseheight - 0.1f) + ((float)fluidRandomizer.Next(1, 9) / 10f)); | 2069 | // m_log.Info((baseheight - 0.1f) + ((float)fluidRandomizer.Next(1, 9) / 10f)); |
2140 | } | 2070 | } |
2141 | 2071 | ||
2142 | |||
2143 | lock (OdeLock) | 2072 | lock (OdeLock) |
2144 | { | 2073 | { |
2145 | if (!(WaterGeom == (IntPtr)0)) | 2074 | if (!(WaterGeom == (IntPtr)0)) |
@@ -2183,7 +2112,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2183 | { | 2112 | { |
2184 | lock (OdeLock) | 2113 | lock (OdeLock) |
2185 | { | 2114 | { |
2186 | |||
2187 | foreach (OdePrim prm in _prims) | 2115 | foreach (OdePrim prm in _prims) |
2188 | { | 2116 | { |
2189 | RemovePrim(prm); | 2117 | RemovePrim(prm); |