aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2012-05-13 01:25:03 +0100
committerMelanie2012-05-13 01:25:03 +0100
commitfe029cf4e8fc0940d887329a823e66e0c29bd92e (patch)
tree7c2ae75849307cda30da96b6300ee30295610b42 /OpenSim/Region
parentMerge branch 'avination' into careminster (diff)
parentubitODE fix force in case of mlinear motor offset present (diff)
downloadopensim-SC_OLD-fe029cf4e8fc0940d887329a823e66e0c29bd92e.zip
opensim-SC_OLD-fe029cf4e8fc0940d887329a823e66e0c29bd92e.tar.gz
opensim-SC_OLD-fe029cf4e8fc0940d887329a823e66e0c29bd92e.tar.bz2
opensim-SC_OLD-fe029cf4e8fc0940d887329a823e66e0c29bd92e.tar.xz
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs9
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs1
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs1
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs4
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs34
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs55
9 files changed, 125 insertions, 29 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index b354cc0..9ae8dfb 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -98,6 +98,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
98 public event AvatarPickerRequest OnAvatarPickerRequest; 98 public event AvatarPickerRequest OnAvatarPickerRequest;
99 public event StartAnim OnStartAnim; 99 public event StartAnim OnStartAnim;
100 public event StopAnim OnStopAnim; 100 public event StopAnim OnStopAnim;
101 public event ChangeAnim OnChangeAnim;
101 public event Action<IClientAPI> OnRequestAvatarsData; 102 public event Action<IClientAPI> OnRequestAvatarsData;
102 public event LinkObjects OnLinkObjects; 103 public event LinkObjects OnLinkObjects;
103 public event DelinkObjects OnDelinkObjects; 104 public event DelinkObjects OnDelinkObjects;
@@ -6386,7 +6387,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6386 return true; 6387 return true;
6387 } 6388 }
6388 #endregion 6389 #endregion
6389 6390/*
6390 StartAnim handlerStartAnim = null; 6391 StartAnim handlerStartAnim = null;
6391 StopAnim handlerStopAnim = null; 6392 StopAnim handlerStopAnim = null;
6392 6393
@@ -6410,6 +6411,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6410 } 6411 }
6411 } 6412 }
6412 return true; 6413 return true;
6414*/
6415 ChangeAnim handlerChangeAnim = null;
6416
6417 for (int i = 0; i < AgentAni.AnimationList.Length; i++)
6418 {
6419 handlerChangeAnim = OnChangeAnim;
6420 if (handlerChangeAnim != null)
6421 {
6422 handlerChangeAnim(AgentAni.AnimationList[i].AnimID, AgentAni.AnimationList[i].StartAnim, false);
6423 }
6424 }
6425
6426 handlerChangeAnim = OnChangeAnim;
6427 if (handlerChangeAnim != null)
6428 {
6429 handlerChangeAnim(UUID.Zero, false, true);
6430 }
6431
6432 return true;
6413 } 6433 }
6414 6434
6415 private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack) 6435 private bool HandleAgentRequestSit(IClientAPI sender, Packet Pack)
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 14ae287..9ddac19 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -79,13 +79,13 @@ namespace OpenSim.Region.Framework.Scenes.Animation
79 m_scenePresence = sp; 79 m_scenePresence = sp;
80 CurrentMovementAnimation = "CROUCH"; 80 CurrentMovementAnimation = "CROUCH";
81 } 81 }
82 82
83 public void AddAnimation(UUID animID, UUID objectID) 83 public void AddAnimation(UUID animID, UUID objectID)
84 { 84 {
85 if (m_scenePresence.IsChildAgent) 85 if (m_scenePresence.IsChildAgent)
86 return; 86 return;
87 87
88// m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name); 88 // m_log.DebugFormat("[SCENE PRESENCE ANIMATOR]: Adding animation {0} for {1}", animID, m_scenePresence.Name);
89 89
90 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID)) 90 if (m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, objectID))
91 SendAnimPack(); 91 SendAnimPack();
@@ -117,6 +117,22 @@ namespace OpenSim.Region.Framework.Scenes.Animation
117 SendAnimPack(); 117 SendAnimPack();
118 } 118 }
119 119
120 public void avnChangeAnim(UUID animID, bool addRemove, bool sendPack)
121 {
122 if (m_scenePresence.IsChildAgent)
123 return;
124
125 if (animID != UUID.Zero)
126 {
127 if (addRemove)
128 m_animations.Add(animID, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero);
129 else
130 m_animations.Remove(animID);
131 }
132 if(sendPack)
133 SendAnimPack();
134 }
135
120 // Called from scripts 136 // Called from scripts
121 public void RemoveAnimation(string name) 137 public void RemoveAnimation(string name)
122 { 138 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 99ad685..1a8caae 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -789,6 +789,7 @@ namespace OpenSim.Region.Framework.Scenes
789 ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun; 789 ControllingClient.OnSetAlwaysRun += HandleSetAlwaysRun;
790 ControllingClient.OnStartAnim += HandleStartAnim; 790 ControllingClient.OnStartAnim += HandleStartAnim;
791 ControllingClient.OnStopAnim += HandleStopAnim; 791 ControllingClient.OnStopAnim += HandleStopAnim;
792 ControllingClient.OnChangeAnim += avnHandleChangeAnim;
792 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls; 793 ControllingClient.OnForceReleaseControls += HandleForceReleaseControls;
793 ControllingClient.OnAutoPilotGo += MoveToTarget; 794 ControllingClient.OnAutoPilotGo += MoveToTarget;
794 795
@@ -2437,6 +2438,13 @@ namespace OpenSim.Region.Framework.Scenes
2437 Animator.RemoveAnimation(animID); 2438 Animator.RemoveAnimation(animID);
2438 } 2439 }
2439 2440
2441 public void avnHandleChangeAnim(UUID animID, bool addRemove,bool sendPack)
2442 {
2443 Animator.avnChangeAnim(animID, addRemove, sendPack);
2444 }
2445
2446
2447
2440 /// <summary> 2448 /// <summary>
2441 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector 2449 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector
2442 /// </summary> 2450 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 94f1b15..a4afd47 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -264,8 +264,12 @@ namespace OpenSim.Region.Framework.Scenes
264 float targetframetime = 1100.0f / (float)m_nominalReportedFps; 264 float targetframetime = 1100.0f / (float)m_nominalReportedFps;
265 265
266 float sparetime; 266 float sparetime;
267 if (TotalFrameTime > targetframetime ) 267 float sleeptime;
268 if (TotalFrameTime > targetframetime)
269 {
268 sparetime = 0; 270 sparetime = 0;
271 sleeptime = 0;
272 }
269 else 273 else
270 { 274 {
271 sparetime = m_frameMS - m_physicsMS - m_agentMS; 275 sparetime = m_frameMS - m_physicsMS - m_agentMS;
@@ -274,6 +278,7 @@ namespace OpenSim.Region.Framework.Scenes
274 sparetime = 0; 278 sparetime = 0;
275 else if (sparetime > TotalFrameTime) 279 else if (sparetime > TotalFrameTime)
276 sparetime = TotalFrameTime; 280 sparetime = TotalFrameTime;
281 sleeptime = m_sleeptimeMS * perframe;
277 } 282 }
278 283
279 // other MS is actually simulation time 284 // other MS is actually simulation time
@@ -363,7 +368,7 @@ namespace OpenSim.Region.Framework.Scenes
363 sb[21].StatValue = sparetime; 368 sb[21].StatValue = sparetime;
364 369
365 sb[22].StatID = (uint)Stats.SimSleepTime; 370 sb[22].StatID = (uint)Stats.SimSleepTime;
366 sb[22].StatValue = m_sleeptimeMS * perframe; 371 sb[22].StatValue = sleeptime;
367 372
368 for (int i = 0; i < 23; i++) 373 for (int i = 0; i < 23; i++)
369 { 374 {
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
index a37e997..eac8e84 100644
--- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
+++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs
@@ -669,6 +669,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
669 public event ObjectDrop OnObjectDrop; 669 public event ObjectDrop OnObjectDrop;
670 public event StartAnim OnStartAnim; 670 public event StartAnim OnStartAnim;
671 public event StopAnim OnStopAnim; 671 public event StopAnim OnStopAnim;
672 public event ChangeAnim OnChangeAnim;
672 public event LinkObjects OnLinkObjects; 673 public event LinkObjects OnLinkObjects;
673 public event DelinkObjects OnDelinkObjects; 674 public event DelinkObjects OnDelinkObjects;
674 public event RequestMapBlocks OnRequestMapBlocks; 675 public event RequestMapBlocks OnRequestMapBlocks;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index c9c12c6..e798382 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -194,6 +194,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
194 public event ObjectDrop OnObjectDrop; 194 public event ObjectDrop OnObjectDrop;
195 public event StartAnim OnStartAnim; 195 public event StartAnim OnStartAnim;
196 public event StopAnim OnStopAnim; 196 public event StopAnim OnStopAnim;
197 public event ChangeAnim OnChangeAnim;
197 public event LinkObjects OnLinkObjects; 198 public event LinkObjects OnLinkObjects;
198 public event DelinkObjects OnDelinkObjects; 199 public event DelinkObjects OnDelinkObjects;
199 public event RequestMapBlocks OnRequestMapBlocks; 200 public event RequestMapBlocks OnRequestMapBlocks;
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
index 43b4581..b0711d7 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODECharacter.cs
@@ -1006,9 +1006,9 @@ namespace OpenSim.Region.Physics.OdePlugin
1006 } 1006 }
1007 } 1007 }
1008 1008
1009 if (velLengthSquared > 625.0f) // 25m/s apply breaks 1009 if (velLengthSquared > 2500.0f) // 50m/s apply breaks
1010 { 1010 {
1011 breakfactor = 0.31f * m_mass; 1011 breakfactor = 0.16f * m_mass;
1012 vec.X -= breakfactor * vel.X; 1012 vec.X -= breakfactor * vel.X;
1013 vec.Y -= breakfactor * vel.Y; 1013 vec.Y -= breakfactor * vel.Y;
1014 vec.Z -= breakfactor * vel.Z; 1014 vec.Z -= breakfactor * vel.Z;
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
index e88e559..e27be1e 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEDynamics.cs
@@ -63,6 +63,9 @@ namespace OpenSim.Region.Physics.OdePlugin
63 private OdeScene _pParentScene; 63 private OdeScene _pParentScene;
64 64
65 // Vehicle properties 65 // Vehicle properties
66 // WARNING this are working copies for internel use
67 // their values may not be the corresponding parameter
68
66 private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier 69 private Quaternion m_referenceFrame = Quaternion.Identity; // Axis modifier
67 private Quaternion m_RollreferenceFrame = Quaternion.Identity; // what hell is this ? 70 private Quaternion m_RollreferenceFrame = Quaternion.Identity; // what hell is this ?
68 71
@@ -244,6 +247,7 @@ namespace OpenSim.Region.Physics.OdePlugin
244 if (pValue < m_timestep) pValue = m_timestep; 247 if (pValue < m_timestep) pValue = m_timestep;
245 else if (pValue > 120) pValue = 120; 248 else if (pValue > 120) pValue = 120;
246 m_angularMotorDecayTimescale = pValue * m_invtimestep; 249 m_angularMotorDecayTimescale = pValue * m_invtimestep;
250 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
247 break; 251 break;
248 case Vehicle.ANGULAR_MOTOR_TIMESCALE: 252 case Vehicle.ANGULAR_MOTOR_TIMESCALE:
249 if (pValue < m_timestep) pValue = m_timestep; 253 if (pValue < m_timestep) pValue = m_timestep;
@@ -293,6 +297,7 @@ namespace OpenSim.Region.Physics.OdePlugin
293 if (pValue < m_timestep) pValue = m_timestep; 297 if (pValue < m_timestep) pValue = m_timestep;
294 else if (pValue > 120) pValue = 120; 298 else if (pValue > 120) pValue = 120;
295 m_linearMotorDecayTimescale = (0.2f +pValue) * m_invtimestep; 299 m_linearMotorDecayTimescale = (0.2f +pValue) * m_invtimestep;
300 m_lmDecay = (1.0f - 1.0f / m_linearMotorDecayTimescale);
296 break; 301 break;
297 case Vehicle.LINEAR_MOTOR_TIMESCALE: 302 case Vehicle.LINEAR_MOTOR_TIMESCALE:
298 if (pValue < m_timestep) pValue = m_timestep; 303 if (pValue < m_timestep) pValue = m_timestep;
@@ -320,7 +325,7 @@ namespace OpenSim.Region.Physics.OdePlugin
320 if (len > 12.566f) 325 if (len > 12.566f)
321 m_angularMotorDirection *= (12.566f / len); 326 m_angularMotorDirection *= (12.566f / len);
322 327
323 m_amEfect = 1.0f / m_angularMotorTimescale; // turn it on 328 m_amEfect = 1.0f ; // turn it on
324 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale; 329 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
325 330
326 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 331 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
@@ -338,7 +343,7 @@ namespace OpenSim.Region.Physics.OdePlugin
338 m_linearMotorDirection *= (100.0f / len); 343 m_linearMotorDirection *= (100.0f / len);
339 344
340 m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale; 345 m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale;
341 m_lmEfect = 1.0f / m_linearMotorTimescale; // turn it on 346 m_lmEfect = 1.0f; // turn it on
342 347
343 m_ffactor = 0.01f; 348 m_ffactor = 0.01f;
344 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 349 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
@@ -374,7 +379,7 @@ namespace OpenSim.Region.Physics.OdePlugin
374 if (len > 12.566f) 379 if (len > 12.566f)
375 m_angularMotorDirection *= (12.566f / len); 380 m_angularMotorDirection *= (12.566f / len);
376 381
377 m_amEfect = 1.0f / m_angularMotorTimescale; // turn it on 382 m_amEfect = 1.0f; // turn it on
378 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale; 383 m_amDecay = 1.0f - 1.0f / m_angularMotorDecayTimescale;
379 384
380 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 385 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
@@ -393,11 +398,9 @@ namespace OpenSim.Region.Physics.OdePlugin
393 if (len > 100.0f) 398 if (len > 100.0f)
394 m_linearMotorDirection *= (100.0f / len); 399 m_linearMotorDirection *= (100.0f / len);
395 400
396 m_lmEfect = 1.0f / m_linearMotorTimescale; // turn it on 401 m_lmEfect = 1.0f; // turn it on
397 m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale; 402 m_lmDecay = 1.0f - 1.0f / m_linearMotorDecayTimescale;
398 403
399
400
401 m_ffactor = 0.01f; 404 m_ffactor = 0.01f;
402 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body) 405 if (rootPrim.Body != IntPtr.Zero && !d.BodyIsEnabled(rootPrim.Body)
403 && !rootPrim.m_isSelected && !rootPrim.m_disabled) 406 && !rootPrim.m_isSelected && !rootPrim.m_disabled)
@@ -747,6 +750,9 @@ namespace OpenSim.Region.Physics.OdePlugin
747 { 750 {
748 IntPtr Body = rootPrim.Body; 751 IntPtr Body = rootPrim.Body;
749 752
753 d.Mass dmass;
754 d.BodyGetMass(Body, out dmass);
755
750 d.Quaternion rot = d.BodyGetQuaternion(Body); 756 d.Quaternion rot = d.BodyGetQuaternion(Body);
751 Quaternion objrotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object 757 Quaternion objrotq = new Quaternion(rot.X, rot.Y, rot.Z, rot.W); // rotq = rotation of object
752 Quaternion rotq = objrotq; // rotq = rotation of object 758 Quaternion rotq = objrotq; // rotq = rotation of object
@@ -776,10 +782,10 @@ namespace OpenSim.Region.Physics.OdePlugin
776 float ldampZ = 0; 782 float ldampZ = 0;
777 783
778 // linear motor 784 // linear motor
779 if (m_lmEfect > 0.001 && m_linearMotorTimescale < 1000) 785 if (m_lmEfect > 0.01 && m_linearMotorTimescale < 1000)
780 { 786 {
781 tmpV = m_linearMotorDirection - curLocalVel; // velocity error 787 tmpV = m_linearMotorDirection - curLocalVel; // velocity error
782 tmpV *= m_lmEfect; // error to correct in this timestep 788 tmpV *= m_lmEfect / m_linearMotorTimescale; // error to correct in this timestep
783 tmpV *= rotq; // to world 789 tmpV *= rotq; // to world
784 790
785 if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != 0) 791 if ((m_flags & VehicleFlag.LIMIT_MOTOR_UP) != 0)
@@ -788,7 +794,7 @@ namespace OpenSim.Region.Physics.OdePlugin
788 if (m_linearMotorOffset.X != 0 || m_linearMotorOffset.Y != 0 || m_linearMotorOffset.Z != 0) 794 if (m_linearMotorOffset.X != 0 || m_linearMotorOffset.Y != 0 || m_linearMotorOffset.Z != 0)
789 { 795 {
790 // have offset, do it now 796 // have offset, do it now
791 tmpV *= rootPrim.Mass; 797 tmpV *= dmass.mass;
792 d.BodyAddForceAtRelPos(Body, tmpV.X, tmpV.Y, tmpV.Z, m_linearMotorOffset.X, m_linearMotorOffset.Y, m_linearMotorOffset.Z); 798 d.BodyAddForceAtRelPos(Body, tmpV.X, tmpV.Y, tmpV.Z, m_linearMotorOffset.X, m_linearMotorOffset.Y, m_linearMotorOffset.Z);
793 } 799 }
794 else 800 else
@@ -799,9 +805,7 @@ namespace OpenSim.Region.Physics.OdePlugin
799 } 805 }
800 806
801 m_lmEfect *= m_lmDecay; 807 m_lmEfect *= m_lmDecay;
802 808 m_ffactor = 0.01f + 1e-4f * curVel.LengthSquared();
803 // m_ffactor = 0.01f + 1e-4f * curVel.LengthSquared();
804 m_ffactor = 0;
805 } 809 }
806 else 810 else
807 { 811 {
@@ -1007,7 +1011,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1007 if (m_amEfect > 0.01 && m_angularMotorTimescale < 1000) 1011 if (m_amEfect > 0.01 && m_angularMotorTimescale < 1000)
1008 { 1012 {
1009 tmpV = m_angularMotorDirection - curLocalAngVel; // velocity error 1013 tmpV = m_angularMotorDirection - curLocalAngVel; // velocity error
1010 tmpV *= m_amEfect; // error to correct in this timestep 1014 tmpV *= m_amEfect / m_angularMotorTimescale; // error to correct in this timestep
1011 torque.X += tmpV.X * m_ampwr; 1015 torque.X += tmpV.X * m_ampwr;
1012 torque.Y += tmpV.Y * m_ampwr; 1016 torque.Y += tmpV.Y * m_ampwr;
1013 torque.Z += tmpV.Z; 1017 torque.Z += tmpV.Z;
@@ -1057,13 +1061,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1057 } 1061 }
1058 1062
1059 1063
1060 d.Mass dmass;
1061 d.BodyGetMass(Body,out dmass);
1062 1064
1063 if (force.X != 0 || force.Y != 0 || force.Z != 0) 1065 if (force.X != 0 || force.Y != 0 || force.Z != 0)
1064 { 1066 {
1065 force *= dmass.mass; 1067 force *= dmass.mass;
1066 d.BodySetForce(Body, force.X, force.Y, force.Z); 1068 d.BodyAddForce(Body, force.X, force.Y, force.Z);
1067 } 1069 }
1068 1070
1069 if (torque.X != 0 || torque.Y != 0 || torque.Z != 0) 1071 if (torque.X != 0 || torque.Y != 0 || torque.Z != 0)
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index e0de6cc..7367719 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -537,7 +537,7 @@ namespace OpenSim.Region.Physics.OdePlugin
537 // Essentially Steps * m_physicsiterations 537 // Essentially Steps * m_physicsiterations
538 d.WorldSetQuickStepNumIterations(world, m_physicsiterations); 538 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
539 539
540 d.WorldSetContactMaxCorrectingVel(world, 50.0f); 540 d.WorldSetContactMaxCorrectingVel(world, 60.0f);
541 541
542 spacesPerMeter = 1 / metersInSpace; 542 spacesPerMeter = 1 / metersInSpace;
543 spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeter); 543 spaceGridMaxX = (int)(WorldExtents.X * spacesPerMeter);
@@ -754,14 +754,15 @@ namespace OpenSim.Region.Physics.OdePlugin
754 } 754 }
755 755
756 // big messy collision analises 756 // big messy collision analises
757
758 Vector3 normoverride = Vector3.Zero; //damm c#
759
757 float mu = 0; 760 float mu = 0;
758 float bounce = 0; 761 float bounce = 0;
759 float cfm = 0.0001f; 762 float cfm = 0.0001f;
760 float erp = 0.1f;
761 float erpscale = 1.0f; 763 float erpscale = 1.0f;
762 float dscale = 1.0f; 764 float dscale = 1.0f;
763 bool IgnoreNegSides = false; 765 bool IgnoreNegSides = false;
764
765 766
766 ContactData contactdata1 = new ContactData(0, 0, false); 767 ContactData contactdata1 = new ContactData(0, 0, false);
767 ContactData contactdata2 = new ContactData(0, 0, false); 768 ContactData contactdata2 = new ContactData(0, 0, false);
@@ -770,14 +771,30 @@ namespace OpenSim.Region.Physics.OdePlugin
770 bool dop1foot = false; 771 bool dop1foot = false;
771 bool dop2foot = false; 772 bool dop2foot = false;
772 bool ignore = false; 773 bool ignore = false;
774 bool AvanormOverride = false;
773 775
774 switch (p1.PhysicsActorType) 776 switch (p1.PhysicsActorType)
775 { 777 {
776 case (int)ActorTypes.Agent: 778 case (int)ActorTypes.Agent:
777 { 779 {
778 bounce = 0; 780 AvanormOverride = true;
779 mu = 0; 781 Vector3 tmp = p2.Position - p1.Position;
780 cfm = 0.0001f; 782 normoverride = p2.Velocity - p1.Velocity;
783 mu = normoverride.LengthSquared();
784
785 if (mu > 1e-6)
786 {
787 mu = 1.0f / (float)Math.Sqrt(mu);
788 normoverride *= mu;
789 mu = Vector3.Dot(tmp, normoverride);
790 if (mu > 0)
791 normoverride *= -1;
792 }
793 else
794 {
795 tmp.Normalize();
796 normoverride = -tmp;
797 }
781 798
782 switch (p2.PhysicsActorType) 799 switch (p2.PhysicsActorType)
783 { 800 {
@@ -824,6 +841,25 @@ namespace OpenSim.Region.Physics.OdePlugin
824 // p1.getContactData(ref contactdata1); 841 // p1.getContactData(ref contactdata1);
825 // p2.getContactData(ref contactdata2); 842 // p2.getContactData(ref contactdata2);
826 843
844 AvanormOverride = true;
845
846 Vector3 tmp = p2.Position - p1.Position;
847 normoverride = p2.Velocity - p1.Velocity;
848 mu = normoverride.LengthSquared();
849 if (mu > 1e-6)
850 {
851 mu = 1.0f / (float)Math.Sqrt(mu);
852 normoverride *= mu;
853 mu = Vector3.Dot(tmp, normoverride);
854 if (mu > 0)
855 normoverride *= -1;
856 }
857 else
858 {
859 tmp.Normalize();
860 normoverride = -tmp;
861 }
862
827 bounce = 0; 863 bounce = 0;
828 mu = 0; 864 mu = 0;
829 cfm = 0.0001f; 865 cfm = 0.0001f;
@@ -974,6 +1010,13 @@ namespace OpenSim.Region.Physics.OdePlugin
974 if (dop2foot && (p2.Position.Z - curContact.pos.Z) > (p2.Size.Z - avCapRadius) * 0.5f) 1010 if (dop2foot && (p2.Position.Z - curContact.pos.Z) > (p2.Size.Z - avCapRadius) * 0.5f)
975 p2.IsColliding = true; 1011 p2.IsColliding = true;
976 1012
1013 if (AvanormOverride && curContact.depth > 0.3f)
1014 {
1015 curContact.normal.X = normoverride.X;
1016 curContact.normal.Y = normoverride.Y;
1017 curContact.normal.Z = normoverride.Z;
1018 }
1019
977 Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale); 1020 Joint = CreateContacJoint(ref curContact, mu, bounce, cfm, erpscale, dscale);
978 d.JointAttach(Joint, b1, b2); 1021 d.JointAttach(Joint, b1, b2);
979 1022