diff options
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODECharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 42 |
1 files changed, 33 insertions, 9 deletions
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 |