aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorDiva Canto2015-11-29 09:48:48 -0800
committerDiva Canto2015-11-29 09:48:48 -0800
commit55a9bbc6ce5ee9e0ffbd2da2bb0a10b2ea1f7325 (patch)
tree9d977c939800eca5797860ecfc825fae817b72e0 /OpenSim
parentTrying to make http requests less slow, according to http://stackoverflow.com... (diff)
parentchange llLookAt math to master cleaner solution, assuming lAxis2rot does work (diff)
downloadopensim-SC_OLD-55a9bbc6ce5ee9e0ffbd2da2bb0a10b2ea1f7325.zip
opensim-SC_OLD-55a9bbc6ce5ee9e0ffbd2da2bb0a10b2ea1f7325.tar.gz
opensim-SC_OLD-55a9bbc6ce5ee9e0ffbd2da2bb0a10b2ea1f7325.tar.bz2
opensim-SC_OLD-55a9bbc6ce5ee9e0ffbd2da2bb0a10b2ea1f7325.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Util.cs4
-rw-r--r--OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/TerrainChannel.cs6
-rwxr-xr-xOpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs9
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs2
-rw-r--r--OpenSim/Region/PhysicsModules/Ode/OdeScene.cs34
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs31
7 files changed, 60 insertions, 30 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 4aad578..3e51f7f 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2315,7 +2315,7 @@ namespace OpenSim.Framework
2315 2315
2316 // It's possible that the thread won't abort. To make sure the thread pool isn't 2316 // It's possible that the thread won't abort. To make sure the thread pool isn't
2317 // depleted, increase the pool size. 2317 // depleted, increase the pool size.
2318 m_ThreadPool.MaxThreads++; 2318// m_ThreadPool.MaxThreads++;
2319 } 2319 }
2320 } 2320 }
2321 } 2321 }
@@ -2430,6 +2430,7 @@ namespace OpenSim.Framework
2430 long numQueued = Interlocked.Increment(ref numQueuedThreadFuncs); 2430 long numQueued = Interlocked.Increment(ref numQueuedThreadFuncs);
2431 try 2431 try
2432 { 2432 {
2433/*
2433 long numRunning = numRunningThreadFuncs; 2434 long numRunning = numRunningThreadFuncs;
2434 2435
2435 if (m_ThreadPool != null && LogOverloads) 2436 if (m_ThreadPool != null && LogOverloads)
@@ -2462,6 +2463,7 @@ namespace OpenSim.Framework
2462 } 2463 }
2463 } 2464 }
2464 else 2465 else
2466*/
2465 { 2467 {
2466 // Since we didn't log "Queue threadfunc", don't log "Run threadfunc" or "End threadfunc" either. 2468 // Since we didn't log "Queue threadfunc", don't log "Run threadfunc" or "End threadfunc" either.
2467 // Those log lines aren't useful when we don't know which function is running in the thread. 2469 // Those log lines aren't useful when we don't know which function is running in the thread.
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
index 1236e83..b61959d 100644
--- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
+++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs
@@ -1028,9 +1028,7 @@ namespace OpenSim.Region.ClientStack.Linden
1028 // for now viwers do send fixed defaults 1028 // for now viwers do send fixed defaults
1029 // but this may change 1029 // but this may change
1030// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger(); 1030// int physicsShapeType = inner_instance_list["physics_shape_type"].AsInteger();
1031 byte physicsShapeType = (byte)PhysShapeType.prim; // default for mesh is simple convex 1031 byte physicsShapeType = (byte)PhysShapeType.convex; // default is simple convex
1032 if(hasmesh)
1033 physicsShapeType = (byte) PhysShapeType.convex; // default for mesh is simple convex
1034// int material = inner_instance_list["material"].AsInteger(); 1032// int material = inner_instance_list["material"].AsInteger();
1035 byte material = (byte)Material.Wood; 1033 byte material = (byte)Material.Wood;
1036 1034
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
index ce5586c..1aa1194 100644
--- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
+++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs
@@ -158,11 +158,7 @@ namespace OpenSim.Region.Framework.Scenes
158 { 158 {
159 if (Double.IsNaN(value) || Double.IsInfinity(value)) 159 if (Double.IsNaN(value) || Double.IsInfinity(value))
160 return; 160 return;
161 if (value < 0) 161
162 value = 0;
163 else
164 if (value > 655.35)
165 value = 655.35;
166 m_terrainData[x, y] = (float)value; 162 m_terrainData[x, y] = (float)value;
167 } 163 }
168 } 164 }
diff --git a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
index c3eb776..6adf219 100755
--- a/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
+++ b/OpenSim/Region/PhysicsModules/BulletS/BSPhysObject.cs
@@ -485,13 +485,20 @@ public abstract class BSPhysObject : PhysicsActor
485 CollisionsLastTick = new CollisionEventUpdate(); 485 CollisionsLastTick = new CollisionEventUpdate();
486 CollisionsLastTickStep = PhysScene.SimulationStep; 486 CollisionsLastTickStep = PhysScene.SimulationStep;
487 } 487 }
488
488 CollisionsLastTick.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 489 CollisionsLastTick.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth));
489 490
490 // If someone has subscribed for collision events log the collision so it will be reported up 491 // If someone has subscribed for collision events log the collision so it will be reported up
491 if (SubscribedEvents()) { 492 if (SubscribedEvents()) {
493 ContactPoint newContact = new ContactPoint(contactPoint, contactNormal, pentrationDepth);
494
495 // make collision sound work just setting a speed
496 // see ubOde
497 newContact.RelativeSpeed = 2.0f;
498
492 lock (PhysScene.CollisionLock) 499 lock (PhysScene.CollisionLock)
493 { 500 {
494 CollisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); 501 CollisionCollection.AddCollider(collidingWith, newContact);
495 } 502 }
496 DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}", 503 DetailLog("{0},{1}.Collision.AddCollider,call,with={2},point={3},normal={4},depth={5},colliderMoving={6}",
497 LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving); 504 LocalID, TypeName, collidingWith, contactPoint, contactNormal, pentrationDepth, ColliderIsMoving);
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
index f535c41..aaf90f2 100644
--- a/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/ODECharacter.cs
@@ -279,7 +279,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
279 279
280 public override bool IsPhysical 280 public override bool IsPhysical
281 { 281 {
282 get { return false; } 282 get { return m_isPhysical; }
283 set { return; } 283 set { return; }
284 } 284 }
285 285
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
index 040322a..e23cca6 100644
--- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
+++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs
@@ -125,7 +125,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
125 /// .../opensim/bin/libode-x86_64.so(_Z12dCollideCCTLP6dxGeomS0_iP12dContactGeomi+0x92) [0x7f03b44bcf82] 125 /// .../opensim/bin/libode-x86_64.so(_Z12dCollideCCTLP6dxGeomS0_iP12dContactGeomi+0x92) [0x7f03b44bcf82]
126 /// </remarks> 126 /// </remarks>
127 internal static Object UniversalColliderSyncObject = new Object(); 127 internal static Object UniversalColliderSyncObject = new Object();
128 128 internal static Object SimulationLock = new Object();
129
129 /// <summary> 130 /// <summary>
130 /// Is stats collecting enabled for this ODE scene? 131 /// Is stats collecting enabled for this ODE scene?
131 /// </summary> 132 /// </summary>
@@ -647,7 +648,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
647 physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0); 648 physics_logging_interval = physicsconfig.GetInt("physics_logging_interval", 0);
648 physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false); 649 physics_logging_append_existing_logfile = physicsconfig.GetBoolean("physics_logging_append_existing_logfile", false);
649 650
650 m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false); 651// m_NINJA_physics_joints_enabled = physicsconfig.GetBoolean("use_NINJA_physics_joints", false);
651 minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f); 652 minimumGroundFlightOffset = physicsconfig.GetFloat("minimum_ground_flight_offset", 3f);
652 maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f); 653 maximumMassObject = physicsconfig.GetFloat("maximum_mass_object", 10000.01f);
653 } 654 }
@@ -1441,9 +1442,28 @@ namespace OpenSim.Region.PhysicsModule.ODE
1441 obj2LocalID = 0; 1442 obj2LocalID = 0;
1442 //ctype = 0; 1443 //ctype = 0;
1443 //cStartStop = 0; 1444 //cStartStop = 0;
1444 if (!p2.SubscribedEvents() && !p1.SubscribedEvents()) 1445// if (!p2.SubscribedEvents() && !p1.SubscribedEvents())
1446// return;
1447 bool p1events = p1.SubscribedEvents();
1448 bool p2events = p2.SubscribedEvents();
1449
1450 if (p1.IsVolumeDtc)
1451 p2events = false;
1452 if (p2.IsVolumeDtc)
1453 p1events = false;
1454
1455 if (!p2events && !p1events)
1445 return; 1456 return;
1446 1457
1458 Vector3 vel = Vector3.Zero;
1459 if (p2 != null && p2.IsPhysical)
1460 vel = p2.Velocity;
1461
1462 if (p1 != null && p1.IsPhysical)
1463 vel -= p1.Velocity;
1464
1465 contact.RelativeSpeed = Vector3.Dot(vel, contact.SurfaceNormal);
1466
1447 switch ((ActorTypes)p2.PhysicsActorType) 1467 switch ((ActorTypes)p2.PhysicsActorType)
1448 { 1468 {
1449 case ActorTypes.Agent: 1469 case ActorTypes.Agent:
@@ -2714,6 +2734,7 @@ namespace OpenSim.Region.PhysicsModule.ODE
2714 CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks 2734 CreateRequestedJoints(); // this must be outside of the lock (OdeLock) to avoid deadlocks
2715 } 2735 }
2716 2736
2737
2717 lock (OdeLock) 2738 lock (OdeLock)
2718 { 2739 {
2719 d.AllocateODEDataForThread(~0U); 2740 d.AllocateODEDataForThread(~0U);
@@ -2867,7 +2888,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
2867 tempTick = tempTick2; 2888 tempTick = tempTick2;
2868 } 2889 }
2869 2890
2870 d.WorldQuickStep(world, ODE_STEPSIZE); 2891 lock(SimulationLock)
2892 d.WorldQuickStep(world, ODE_STEPSIZE);
2871 2893
2872 if (CollectStats) 2894 if (CollectStats)
2873 m_stats[ODENativeStepFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick); 2895 m_stats[ODENativeStepFrameMsStatName] += Util.EnvironmentTickCountSubtract(tempTick);
@@ -3377,7 +3399,8 @@ namespace OpenSim.Region.PhysicsModule.ODE
3377 [HandleProcessCorruptedStateExceptions] 3399 [HandleProcessCorruptedStateExceptions]
3378 public override void Dispose() 3400 public override void Dispose()
3379 { 3401 {
3380 lock (OdeLock) 3402 lock(SimulationLock)
3403 lock(OdeLock)
3381 { 3404 {
3382 if(world == IntPtr.Zero) 3405 if(world == IntPtr.Zero)
3383 return; 3406 return;
@@ -3425,7 +3448,6 @@ namespace OpenSim.Region.PhysicsModule.ODE
3425 { 3448 {
3426 m_log.ErrorFormat("[ODE SCENE]: exception {0}", e.Message); 3449 m_log.ErrorFormat("[ODE SCENE]: exception {0}", e.Message);
3427 } 3450 }
3428 //d.CloseODE();
3429 } 3451 }
3430 } 3452 }
3431 3453
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 61397cd..38cbdbc 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3550,19 +3550,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3550 m_host.AddScriptLPS(1); 3550 m_host.AddScriptLPS(1);
3551 3551
3552 // Get the normalized vector to the target 3552 // Get the normalized vector to the target
3553 LSL_Vector d1 = llVecNorm(target - llGetPos()); 3553 LSL_Vector from = llGetPos();
3554 3554
3555 // Get the bearing (yaw) 3555 // normalized direction to target
3556 LSL_Vector a1 = new LSL_Vector(0,0,0); 3556 LSL_Vector dir = llVecNorm(target - from);
3557 a1.z = llAtan2(d1.y, d1.x);
3558 3557
3559 // Get the elevation (pitch) 3558 // use vertical to help compute left axis
3560 LSL_Vector a2 = new LSL_Vector(0,0,0); 3559// LSL_Vector up = new LSL_Vector(0.0, 0.0, 1.0);
3561 a2.y= -llAtan2(d1.z, llSqrt((d1.x * d1.x) + (d1.y * d1.y))); 3560 // find normalized left axis parallel to horizon
3561// LSL_Vector left = llVecNorm(LSL_Vector.Cross(up, dir));
3562
3563 LSL_Vector left = new LSL_Vector(-dir.y, dir.x, 0.0f);
3564 left = llVecNorm(left);
3565 // make up orthogonal to left and dir
3566 LSL_Vector up = LSL_Vector.Cross(dir, left);
3562 3567
3563 LSL_Rotation r1 = llEuler2Rot(a1); 3568 // compute rotation based on orthogonal axes
3564 LSL_Rotation r2 = llEuler2Rot(a2); 3569 // and rotate so Z points to target with X below horizont
3565 LSL_Rotation r3 = new LSL_Rotation(0.000000, 0.707107, 0.000000, 0.707107); 3570 LSL_Rotation rot = new LSL_Rotation(0.0, 0.707107, 0.0, 0.707107) * llAxes2Rot(dir, left, up);
3566 3571
3567 if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) 3572 if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical)
3568 { 3573 {
@@ -3570,17 +3575,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3570 if (strength <= 0.0 || damping <= 0.0) 3575 if (strength <= 0.0 || damping <= 0.0)
3571 return; 3576 return;
3572 3577
3573 llSetRot(r3 * r2 * r1); 3578 llSetRot(rot);
3574 } 3579 }
3575 else 3580 else
3576 { 3581 {
3577 if (strength == 0) 3582 if (strength == 0)
3578 { 3583 {
3579 llSetRot(r3 * r2 * r1); 3584 llSetRot(rot);
3580 return; 3585 return;
3581 } 3586 }
3582 3587
3583 m_host.StartLookAt((Quaternion)(r3 * r2 * r1), (float)strength, (float)damping); 3588 m_host.StartLookAt(rot, (float)strength, (float)damping);
3584 } 3589 }
3585 } 3590 }
3586 3591