diff options
author | Teravus Ovares | 2008-01-28 03:25:02 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-28 03:25:02 +0000 |
commit | 5e36feada2a109ef01944eee4ed34fefdacf36a5 (patch) | |
tree | 8bf8f5216d1d3f49a0b8ea078ac281e9423ab243 | |
parent | * Highly experimental ODE_STEPSIZE = 0.025f - 1000 / 25 = 40fps - 10 substeps... (diff) | |
download | opensim-SC-5e36feada2a109ef01944eee4ed34fefdacf36a5.zip opensim-SC-5e36feada2a109ef01944eee4ed34fefdacf36a5.tar.gz opensim-SC-5e36feada2a109ef01944eee4ed34fefdacf36a5.tar.bz2 opensim-SC-5e36feada2a109ef01944eee4ed34fefdacf36a5.tar.xz |
* Mostly ODE update. Things are a bit more behaved then the last experimental update.
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 42 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 7 |
3 files changed, 47 insertions, 11 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index de3380a..75ccf1a 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -812,7 +812,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
812 | } | 812 | } |
813 | 813 | ||
814 | if (m_physicsActor == null) | 814 | if (m_physicsActor == null) |
815 | { | ||
815 | AddToPhysicalScene(); | 816 | AddToPhysicalScene(); |
817 | |||
818 | } | ||
816 | 819 | ||
817 | m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); | 820 | m_pos += m_parentPosition + new LLVector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); |
818 | m_parentPosition = new LLVector3(); | 821 | m_parentPosition = new LLVector3(); |
@@ -820,6 +823,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
820 | 823 | ||
821 | m_parentID = 0; | 824 | m_parentID = 0; |
822 | SendFullUpdateToAllClients(); | 825 | SendFullUpdateToAllClients(); |
826 | |||
827 | if (m_physicsActor != null) | ||
828 | { | ||
829 | SetHeight(m_avHeight); | ||
830 | |||
831 | } | ||
823 | } | 832 | } |
824 | 833 | ||
825 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"], 1); | 834 | SetMovementAnimation(Animations.AnimsLLUUID["STAND"], 1); |
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 6bd2706..aa74509 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -112,11 +112,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
112 | if (System.Environment.OSVersion.Platform == PlatformID.Unix) | 112 | if (System.Environment.OSVersion.Platform == PlatformID.Unix) |
113 | { | 113 | { |
114 | m_foundDebian = true; | 114 | m_foundDebian = true; |
115 | m_tensor = 1000000f; | 115 | m_tensor = 2000000f; |
116 | } | 116 | } |
117 | else | 117 | else |
118 | { | 118 | { |
119 | m_tensor = 1000000f; | 119 | m_tensor = 1300000f; |
120 | } | 120 | } |
121 | 121 | ||
122 | m_StandUpRotation = | 122 | m_StandUpRotation = |
@@ -366,7 +366,17 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
366 | /// <param name="npositionZ"></param> | 366 | /// <param name="npositionZ"></param> |
367 | private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ, float tensor) | 367 | private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ, float tensor) |
368 | { | 368 | { |
369 | 369 | ||
370 | if (System.Environment.OSVersion.Platform == PlatformID.Unix) | ||
371 | { | ||
372 | m_foundDebian = true; | ||
373 | m_tensor = 2000000f; | ||
374 | } | ||
375 | else | ||
376 | { | ||
377 | m_tensor = 550000f; | ||
378 | } | ||
379 | |||
370 | int dAMotorEuler = 1; | 380 | int dAMotorEuler = 1; |
371 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); | 381 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); |
372 | d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); | 382 | d.MassSetCapsuleTotal(out ShellMass, m_mass, 2, CAPSULE_RADIUS, CAPSULE_LENGTH); |
@@ -561,7 +571,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
561 | 571 | ||
562 | // If the PID Controller isn't active then we set our force | 572 | // If the PID Controller isn't active then we set our force |
563 | // calculating base velocity to the current position | 573 | // calculating base velocity to the current position |
564 | 574 | PID_D = 2200.0f; | |
575 | PID_P = 900.0f; | ||
565 | 576 | ||
566 | if (m_pidControllerActive == false) | 577 | if (m_pidControllerActive == false) |
567 | { | 578 | { |
@@ -599,8 +610,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
599 | // Prim to avatar collisions | 610 | // Prim to avatar collisions |
600 | 611 | ||
601 | d.Vector3 pos = d.BodyGetPosition(Body); | 612 | d.Vector3 pos = d.BodyGetPosition(Body); |
602 | vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * PID_P; | 613 | vec.X = (_target_velocity.X - vel.X) * (PID_D) + (_zeroPosition.X - pos.X) * (PID_P * 2); |
603 | vec.Y = (_target_velocity.Y - vel.Y)*(PID_D) + (_zeroPosition.Y - pos.Y)*PID_P; | 614 | vec.Y = (_target_velocity.Y - vel.Y)*(PID_D) + (_zeroPosition.Y - pos.Y)* (PID_P * 2); |
604 | if (flying) | 615 | if (flying) |
605 | { | 616 | { |
606 | vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; | 617 | vec.Z = (_target_velocity.Z - vel.Z) * (PID_D) + (_zeroPosition.Z - pos.Z) * PID_P; |
@@ -612,12 +623,25 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
612 | { | 623 | { |
613 | m_pidControllerActive = true; | 624 | m_pidControllerActive = true; |
614 | _zeroFlag = false; | 625 | _zeroFlag = false; |
615 | if (m_iscolliding || flying) | 626 | if (m_iscolliding && !flying) |
627 | { | ||
628 | // We're flying and colliding with something | ||
629 | vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * (PID_D); | ||
630 | vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D); | ||
631 | } | ||
632 | else if (m_iscolliding && flying) | ||
616 | { | 633 | { |
617 | // We're flying and colliding with something | 634 | // We're flying and colliding with something |
618 | vec.X = ((_target_velocity.X/movementdivisor) - vel.X)*PID_D; | 635 | vec.X = ((_target_velocity.X/movementdivisor) - vel.X)*(PID_D / 16); |
619 | vec.Y = ((_target_velocity.Y/movementdivisor) - vel.Y)*PID_D; | 636 | vec.Y = ((_target_velocity.Y/movementdivisor) - vel.Y)*(PID_D / 16); |
620 | } | 637 | } |
638 | else if (!m_iscolliding && flying) | ||
639 | { | ||
640 | // We're flying and colliding with something | ||
641 | vec.X = ((_target_velocity.X / movementdivisor) - vel.X) * (PID_D/6); | ||
642 | vec.Y = ((_target_velocity.Y / movementdivisor) - vel.Y) * (PID_D/6); | ||
643 | } | ||
644 | |||
621 | if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) | 645 | if (m_iscolliding && !flying && _target_velocity.Z > 0.0f) |
622 | { | 646 | { |
623 | // We're colliding with something and we're not flying but we're moving | 647 | // We're colliding with something and we're not flying but we're moving |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index e22b2a1..610d4de 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -338,7 +338,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
338 | { | 338 | { |
339 | //This is disabled at the moment only because it needs more tweaking | 339 | //This is disabled at the moment only because it needs more tweaking |
340 | //It will eventually be uncommented | 340 | //It will eventually be uncommented |
341 | /* | 341 | |
342 | if (contacts[i].depth >= 1.00f) | 342 | if (contacts[i].depth >= 1.00f) |
343 | { | 343 | { |
344 | //MainLog.Instance.Debug("PHYSICS",contacts[i].depth.ToString()); | 344 | //MainLog.Instance.Debug("PHYSICS",contacts[i].depth.ToString()); |
@@ -350,6 +350,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
350 | (p1.PhysicsActorType == (int) ActorTypes.Agent && | 350 | (p1.PhysicsActorType == (int) ActorTypes.Agent && |
351 | p2.PhysicsActorType == (int) ActorTypes.Prim)) | 351 | p2.PhysicsActorType == (int) ActorTypes.Prim)) |
352 | { | 352 | { |
353 | //contacts[i].depth = contacts[i].depth * 4.15f; | ||
354 | /* | ||
353 | if (p2.PhysicsActorType == (int) ActorTypes.Agent) | 355 | if (p2.PhysicsActorType == (int) ActorTypes.Agent) |
354 | { | 356 | { |
355 | p2.CollidingObj = true; | 357 | p2.CollidingObj = true; |
@@ -380,8 +382,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
380 | 382 | ||
381 | //contacts[i].depth = 0.0000000f; | 383 | //contacts[i].depth = 0.0000000f; |
382 | } | 384 | } |
385 | */ | ||
383 | } | 386 | } |
384 | */ | 387 | |
385 | 388 | ||
386 | // If you interpenetrate a prim with another prim | 389 | // If you interpenetrate a prim with another prim |
387 | if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) | 390 | if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) |