aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
authorKitto Flora2009-12-31 16:07:36 -0500
committerKitto Flora2009-12-31 16:07:36 -0500
commit3f901d313bfd11070d5260f867c8a73c14f2d109 (patch)
tree20ecdfa6538c48ee23f9ad155579a102dfdf3898 /OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
parentMerge branch 'master' into careminster (diff)
downloadopensim-SC-3f901d313bfd11070d5260f867c8a73c14f2d109.zip
opensim-SC-3f901d313bfd11070d5260f867c8a73c14f2d109.tar.gz
opensim-SC-3f901d313bfd11070d5260f867c8a73c14f2d109.tar.bz2
opensim-SC-3f901d313bfd11070d5260f867c8a73c14f2d109.tar.xz
Vehicle Linear parameter adjustments
Diffstat (limited to 'OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs61
1 files changed, 35 insertions, 26 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
index f48649e..60786d4 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
@@ -229,7 +229,7 @@ namespace OpenSim.Region.Physics.OdePlugin
229 229
230 public int bodyFramesAutoDisable = 20; 230 public int bodyFramesAutoDisable = 20;
231 231
232 232 protected DateTime m_lastframe = DateTime.UtcNow;
233 233
234 private float[] _watermap; 234 private float[] _watermap;
235 private bool m_filterCollisions = true; 235 private bool m_filterCollisions = true;
@@ -2639,13 +2639,20 @@ namespace OpenSim.Region.Physics.OdePlugin
2639 { 2639 {
2640 if (framecount >= int.MaxValue) 2640 if (framecount >= int.MaxValue)
2641 framecount = 0; 2641 framecount = 0;
2642
2643 //if (m_worldOffset != Vector3.Zero) 2642 //if (m_worldOffset != Vector3.Zero)
2644 // return 0; 2643 // return 0;
2645 2644
2646 framecount++; 2645 framecount++;
2647 2646
2648 float fps = 0; 2647 DateTime now = DateTime.UtcNow;
2648 TimeSpan SinceLastFrame = now - m_lastframe;
2649 m_lastframe = now;
2650 float realtime = (float)SinceLastFrame.TotalSeconds;
2651// Console.WriteLine("ts={0} rt={1}", timeStep, realtime);
2652 timeStep = realtime;
2653
2654 // float fps = 1.0f / realtime;
2655 float fps = 0.0f; // number of ODE steps in this Simulate step
2649 //m_log.Info(timeStep.ToString()); 2656 //m_log.Info(timeStep.ToString());
2650 step_time += timeStep; 2657 step_time += timeStep;
2651 2658
@@ -2691,11 +2698,11 @@ namespace OpenSim.Region.Physics.OdePlugin
2691 // Figure out the Frames Per Second we're going at. 2698 // Figure out the Frames Per Second we're going at.
2692 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size 2699 //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size
2693 2700
2694 fps = (step_time / ODE_STEPSIZE) * 1000; 2701 // fps = (step_time / ODE_STEPSIZE) * 1000;
2695 // HACK: Using a time dilation of 1.0 to debug rubberbanding issues 2702 // HACK: Using a time dilation of 1.0 to debug rubberbanding issues
2696 //m_timeDilation = Math.Min((step_time / ODE_STEPSIZE) / (0.09375f / ODE_STEPSIZE), 1.0f); 2703 //m_timeDilation = Math.Min((step_time / ODE_STEPSIZE) / (0.09375f / ODE_STEPSIZE), 1.0f);
2697 2704
2698 step_time = 0.09375f; 2705 // step_time = 0.09375f;
2699 2706
2700 while (step_time > 0.0f) 2707 while (step_time > 0.0f)
2701 { 2708 {
@@ -2716,7 +2723,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2716 foreach (OdeCharacter character in _taintedActors) 2723 foreach (OdeCharacter character in _taintedActors)
2717 { 2724 {
2718 2725
2719 character.ProcessTaints(timeStep); 2726 character.ProcessTaints(ODE_STEPSIZE);
2720 2727
2721 processedtaints = true; 2728 processedtaints = true;
2722 //character.m_collisionscore = 0; 2729 //character.m_collisionscore = 0;
@@ -2725,7 +2732,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2725 if (processedtaints) 2732 if (processedtaints)
2726 _taintedActors.Clear(); 2733 _taintedActors.Clear();
2727 } 2734 }
2728 } 2735 } // end lock _taintedActors
2729 2736
2730 // Modify other objects in the scene. 2737 // Modify other objects in the scene.
2731 processedtaints = false; 2738 processedtaints = false;
@@ -2742,7 +2749,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2742 else 2749 else
2743 { 2750 {
2744 //Console.WriteLine("Simulate calls ProcessTaints"); 2751 //Console.WriteLine("Simulate calls ProcessTaints");
2745 prim.ProcessTaints(timeStep); 2752 prim.ProcessTaints(ODE_STEPSIZE);
2746 } 2753 }
2747 processedtaints = true; 2754 processedtaints = true;
2748 prim.m_collisionscore = 0; 2755 prim.m_collisionscore = 0;
@@ -2767,7 +2774,8 @@ namespace OpenSim.Region.Physics.OdePlugin
2767 foreach (PhysicsJoint joint in pendingJoints) 2774 foreach (PhysicsJoint joint in pendingJoints)
2768 { 2775 {
2769 //DoJointErrorMessage(joint, "taint: time to create joint with parms: " + joint.RawParams); 2776 //DoJointErrorMessage(joint, "taint: time to create joint with parms: " + joint.RawParams);
2770 string[] jointParams = joint.RawParams.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries); 2777 string[] jointParams = joint.RawParams.Split(" ".ToCharArray(),
2778 System.StringSplitOptions.RemoveEmptyEntries);
2771 List<IntPtr> jointBodies = new List<IntPtr>(); 2779 List<IntPtr> jointBodies = new List<IntPtr>();
2772 bool allJointBodiesAreReady = true; 2780 bool allJointBodiesAreReady = true;
2773 foreach (string jointParam in jointParams) 2781 foreach (string jointParam in jointParams)
@@ -2934,13 +2942,13 @@ namespace OpenSim.Region.Physics.OdePlugin
2934 //DoJointErrorMessage(successfullyProcessedJoint, "done"); 2942 //DoJointErrorMessage(successfullyProcessedJoint, "done");
2935 } 2943 }
2936 } 2944 }
2937 } 2945 } // end SupportsNINJAJoints
2938 2946
2939 if (processedtaints) 2947 if (processedtaints)
2940//Console.WriteLine("Simulate calls Clear of _taintedPrim list"); 2948//Console.WriteLine("Simulate calls Clear of _taintedPrim list");
2941 _taintedPrimH.Clear(); 2949 _taintedPrimH.Clear(); // ??? if this only ???
2942 _taintedPrimL.Clear(); 2950 _taintedPrimL.Clear();
2943 } 2951 } // end lock _taintedPrimLock
2944 2952
2945 // Move characters 2953 // Move characters
2946 lock (_characters) 2954 lock (_characters)
@@ -2949,7 +2957,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2949 foreach (OdeCharacter actor in _characters) 2957 foreach (OdeCharacter actor in _characters)
2950 { 2958 {
2951 if (actor != null) 2959 if (actor != null)
2952 actor.Move(timeStep, defects); 2960 actor.Move(ODE_STEPSIZE, defects);
2953 } 2961 }
2954 if (0 != defects.Count) 2962 if (0 != defects.Count)
2955 { 2963 {
@@ -2958,7 +2966,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2958 RemoveCharacter(defect); 2966 RemoveCharacter(defect);
2959 } 2967 }
2960 } 2968 }
2961 } 2969 } // end lock _characters
2962 2970
2963 // Move other active objects 2971 // Move other active objects
2964 lock (_activeprims) 2972 lock (_activeprims)
@@ -2966,9 +2974,9 @@ namespace OpenSim.Region.Physics.OdePlugin
2966 foreach (OdePrim prim in _activeprims) 2974 foreach (OdePrim prim in _activeprims)
2967 { 2975 {
2968 prim.m_collisionscore = 0; 2976 prim.m_collisionscore = 0;
2969 prim.Move(timeStep); 2977 prim.Move(ODE_STEPSIZE);
2970 } 2978 }
2971 } 2979 } // end lock _activeprims
2972 2980
2973 //if ((framecount % m_randomizeWater) == 0) 2981 //if ((framecount % m_randomizeWater) == 0)
2974 // randomizeWater(waterlevel); 2982 // randomizeWater(waterlevel);
@@ -2976,7 +2984,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2976 //int RayCastTimeMS = m_rayCastManager.ProcessQueuedRequests(); 2984 //int RayCastTimeMS = m_rayCastManager.ProcessQueuedRequests();
2977 m_rayCastManager.ProcessQueuedRequests(); 2985 m_rayCastManager.ProcessQueuedRequests();
2978 2986
2979 collision_optimized(timeStep); 2987 collision_optimized(ODE_STEPSIZE);
2980 2988
2981 lock (_collisionEventPrim) 2989 lock (_collisionEventPrim)
2982 { 2990 {
@@ -2998,7 +3006,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2998 break; 3006 break;
2999 } 3007 }
3000 } 3008 }
3001 } 3009 } // end lock _collisionEventPrim
3002 3010
3003 //if (m_global_contactcount > 5) 3011 //if (m_global_contactcount > 5)
3004 //{ 3012 //{
@@ -3009,8 +3017,9 @@ namespace OpenSim.Region.Physics.OdePlugin
3009 3017
3010 d.WorldQuickStep(world, ODE_STEPSIZE); 3018 d.WorldQuickStep(world, ODE_STEPSIZE);
3011 d.JointGroupEmpty(contactgroup); 3019 d.JointGroupEmpty(contactgroup);
3020 fps++;
3012 //ode.dunlock(world); 3021 //ode.dunlock(world);
3013 } 3022 } // end try
3014 catch (Exception e) 3023 catch (Exception e)
3015 { 3024 {
3016 m_log.ErrorFormat("[PHYSICS]: {0}, {1}, {2}", e.Message, e.TargetSite, e); 3025 m_log.ErrorFormat("[PHYSICS]: {0}, {1}, {2}", e.Message, e.TargetSite, e);
@@ -3025,7 +3034,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3025 //fps = 0; 3034 //fps = 0;
3026 //} 3035 //}
3027 //} 3036 //}
3028 } 3037 } // end while (step_time > 0.0f)
3029 3038
3030 lock (_characters) 3039 lock (_characters)
3031 { 3040 {
@@ -3090,7 +3099,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3090 } 3099 }
3091 } 3100 }
3092 } 3101 }
3093 } 3102 } // end lock _activeprims
3094 3103
3095 //DumpJointInfo(); 3104 //DumpJointInfo();
3096 3105
@@ -3111,10 +3120,10 @@ namespace OpenSim.Region.Physics.OdePlugin
3111 } 3120 }
3112 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix); 3121 d.WorldExportDIF(world, fname, physics_logging_append_existing_logfile, prefix);
3113 } 3122 }
3114 } 3123 } // end lock OdeLock
3115 3124
3116 return fps; 3125 return fps * 1000.0f; //NB This is a FRAME COUNT, not a time! AND is divide by 1000 in SimStatusReporter!
3117 } 3126 } // end Simulate
3118 3127
3119 public override void GetResults() 3128 public override void GetResults()
3120 { 3129 {