aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-05-19 16:35:48 +0100
committerUbitUmarov2012-05-19 16:35:48 +0100
commit10889c86d9d67ca994a090166ad53840ed1dedd0 (patch)
tree21f169cb630f952ccf70072ac1cb73761f16bda5 /OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
parent a bit faster collision sound type verification plus a few fixes/changes (diff)
downloadopensim-SC-10889c86d9d67ca994a090166ad53840ed1dedd0.zip
opensim-SC-10889c86d9d67ca994a090166ad53840ed1dedd0.tar.gz
opensim-SC-10889c86d9d67ca994a090166ad53840ed1dedd0.tar.bz2
opensim-SC-10889c86d9d67ca994a090166ad53840ed1dedd0.tar.xz
reduce useless waste of cpu. Make character collision events be done similiar to parts. Let same thread do it all ( like in parts ) ( to change this some structs copies must be added)
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs121
1 files changed, 61 insertions, 60 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
index 5db4f17..b2af180 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs
@@ -477,58 +477,58 @@ namespace OpenSim.Region.Physics.OdePlugin
477 477
478 // if(childPrim) we only know about physical linksets 478 // if(childPrim) we only know about physical linksets
479 return Ptot; 479 return Ptot;
480 /* 480/*
481 float tmass = _mass; 481 float tmass = _mass;
482 Ptot *= tmass; 482 Ptot *= tmass;
483 483
484 float m; 484 float m;
485 485
486 foreach (OdePrim prm in childrenPrim) 486 foreach (OdePrim prm in childrenPrim)
487 { 487 {
488 m = prm._mass; 488 m = prm._mass;
489 Ptot += prm.CenterOfMass * m; 489 Ptot += prm.CenterOfMass * m;
490 tmass += m; 490 tmass += m;
491 } 491 }
492 492
493 if (tmass == 0) 493 if (tmass == 0)
494 tmass = 0; 494 tmass = 0;
495 else 495 else
496 tmass = 1.0f / tmass; 496 tmass = 1.0f / tmass;
497 497
498 Ptot *= tmass; 498 Ptot *= tmass;
499 return Ptot; 499 return Ptot;
500 */ 500*/
501 } 501 }
502 else 502 else
503 return _position; 503 return _position;
504 } 504 }
505 } 505 }
506 } 506 }
507 /* 507/*
508 public override Vector3 PrimOOBsize 508 public override Vector3 PrimOOBsize
509 { 509 {
510 get 510 get
511 { 511 {
512 return primOOBsize; 512 return primOOBsize;
513 } 513 }
514 } 514 }
515 515
516 public override Vector3 PrimOOBoffset 516 public override Vector3 PrimOOBoffset
517 { 517 {
518 get 518 get
519 { 519 {
520 return primOOBoffset; 520 return primOOBoffset;
521 } 521 }
522 } 522 }
523 523
524 public override float PrimOOBRadiusSQ 524 public override float PrimOOBRadiusSQ
525 { 525 {
526 get 526 get
527 { 527 {
528 return primOOBradiusSQ; 528 return primOOBradiusSQ;
529 } 529 }
530 } 530 }
531 */ 531*/
532 public override PrimitiveBaseShape Shape 532 public override PrimitiveBaseShape Shape
533 { 533 {
534 set 534 set
@@ -582,7 +582,7 @@ namespace OpenSim.Region.Physics.OdePlugin
582 if (value.IsFinite()) 582 if (value.IsFinite())
583 { 583 {
584 AddChange(changes.Velocity, value); 584 AddChange(changes.Velocity, value);
585 // _velocity = value; 585// _velocity = value;
586 586
587 } 587 }
588 else 588 else
@@ -937,12 +937,10 @@ namespace OpenSim.Region.Physics.OdePlugin
937 if (CollisionEventsThisFrame == null) 937 if (CollisionEventsThisFrame == null)
938 CollisionEventsThisFrame = new CollisionEventUpdate(); 938 CollisionEventsThisFrame = new CollisionEventUpdate();
939 SentEmptyCollisionsEvent = false; 939 SentEmptyCollisionsEvent = false;
940 _parent_scene.AddCollisionEventReporting(this);
941 } 940 }
942 941
943 public override void UnSubscribeEvents() 942 public override void UnSubscribeEvents()
944 { 943 {
945 _parent_scene.RemoveCollisionEventReporting(this);
946 if (CollisionEventsThisFrame != null) 944 if (CollisionEventsThisFrame != null)
947 { 945 {
948 CollisionEventsThisFrame.Clear(); 946 CollisionEventsThisFrame.Clear();
@@ -975,7 +973,10 @@ namespace OpenSim.Region.Physics.OdePlugin
975 base.SendCollisionUpdate(CollisionEventsThisFrame); 973 base.SendCollisionUpdate(CollisionEventsThisFrame);
976 974
977 if (ncolisions == 0) 975 if (ncolisions == 0)
976 {
978 SentEmptyCollisionsEvent = true; 977 SentEmptyCollisionsEvent = true;
978 _parent_scene.RemoveCollisionEventReporting(this);
979 }
979 else 980 else
980 { 981 {
981 SentEmptyCollisionsEvent = false; 982 SentEmptyCollisionsEvent = false;
@@ -1735,8 +1736,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1735 1736
1736 d.BodySetAutoDisableFlag(Body, true); 1737 d.BodySetAutoDisableFlag(Body, true);
1737 d.BodySetAutoDisableSteps(Body, body_autodisable_frames); 1738 d.BodySetAutoDisableSteps(Body, body_autodisable_frames);
1738 // d.BodySetLinearDampingThreshold(Body, 0.01f); 1739// d.BodySetLinearDampingThreshold(Body, 0.01f);
1739 // d.BodySetAngularDampingThreshold(Body, 0.001f); 1740// d.BodySetAngularDampingThreshold(Body, 0.001f);
1740 d.BodySetDamping(Body, .002f, .002f); 1741 d.BodySetDamping(Body, .002f, .002f);
1741 1742
1742 if (m_targetSpace != IntPtr.Zero) 1743 if (m_targetSpace != IntPtr.Zero)
@@ -2966,7 +2967,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2966 givefakepos--; 2967 givefakepos--;
2967 if (givefakepos < 0) 2968 if (givefakepos < 0)
2968 givefakepos = 0; 2969 givefakepos = 0;
2969 // changeSelectedStatus(); 2970// changeSelectedStatus();
2970 resetCollisionAccounting(); 2971 resetCollisionAccounting();
2971 } 2972 }
2972 2973
@@ -2981,14 +2982,14 @@ namespace OpenSim.Region.Physics.OdePlugin
2981 { 2982 {
2982 _orientation = newOri; 2983 _orientation = newOri;
2983 } 2984 }
2984 /* 2985/*
2985 else if (m_forcePosOrRotation && _orientation != newOri && Body != IntPtr.Zero) 2986 else if (m_forcePosOrRotation && _orientation != newOri && Body != IntPtr.Zero)
2986 { 2987 {
2987 FixInertia(_position, newOri); 2988 FixInertia(_position, newOri);
2988 if (!d.BodyIsEnabled(Body)) 2989 if (!d.BodyIsEnabled(Body))
2989 d.BodyEnable(Body); 2990 d.BodyEnable(Body);
2990 } 2991 }
2991 */ 2992*/
2992 } 2993 }
2993 else 2994 else
2994 { 2995 {
@@ -3939,12 +3940,12 @@ namespace OpenSim.Region.Physics.OdePlugin
3939 changevelocity((Vector3)arg); 3940 changevelocity((Vector3)arg);
3940 break; 3941 break;
3941 3942
3942 // case changes.Acceleration: 3943// case changes.Acceleration:
3943 // changeacceleration((Vector3)arg); 3944// changeacceleration((Vector3)arg);
3944 // break; 3945// break;
3945 // case changes.AngVelocity: 3946// case changes.AngVelocity:
3946 // changeangvelocity((Vector3)arg); 3947// changeangvelocity((Vector3)arg);
3947 // break; 3948// break;
3948 3949
3949 case changes.Force: 3950 case changes.Force:
3950 changeForce((Vector3)arg); 3951 changeForce((Vector3)arg);