diff options
author | nlin | 2009-07-15 10:09:37 +0000 |
---|---|---|
committer | nlin | 2009-07-15 10:09:37 +0000 |
commit | 56d295cfb5af59c7aecafcc817dc0ec2a90a035c (patch) | |
tree | e28edb68ddcaee8224c06ac3daac1b4ac8f2ef22 /OpenSim/Region/Physics | |
parent | Bump version in Framework/Servers/VersionInfo to 0.6.6. (diff) | |
download | opensim-SC_OLD-56d295cfb5af59c7aecafcc817dc0ec2a90a035c.zip opensim-SC_OLD-56d295cfb5af59c7aecafcc817dc0ec2a90a035c.tar.gz opensim-SC_OLD-56d295cfb5af59c7aecafcc817dc0ec2a90a035c.tar.bz2 opensim-SC_OLD-56d295cfb5af59c7aecafcc817dc0ec2a90a035c.tar.xz |
Fix for avatar falling through terrain when av_capsule_tilted=false, Mantis #2905
This fix re-introduces a small tilt into the capsule to prevent
avatar falling through terrain. Re-introduction of the tilt means
that some direction-dependent behavior when walking over prims, but
I have tried to minimize this.
Additionally this commit allows the capsule to wobble slightly when
being pushed around the terrain. This should make walking over prims
easier, as the capsule can wobble and glide diagonally over the prim's
edge, instead of rigidly being stopped vertically against the prim's
face.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 86 |
1 files changed, 78 insertions, 8 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 9aff1ca..9d60cca 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | |||
@@ -49,16 +49,20 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
49 | FudgeFactor = 4, | 49 | FudgeFactor = 4, |
50 | Bounce = 5, | 50 | Bounce = 5, |
51 | CFM = 6, | 51 | CFM = 6, |
52 | ERP = 7, | 52 | StopERP = 7, |
53 | StopCFM = 8, | 53 | StopCFM = 8, |
54 | LoStop2 = 256, | 54 | LoStop2 = 256, |
55 | HiStop2 = 257, | 55 | HiStop2 = 257, |
56 | Vel2 = 258, | 56 | Vel2 = 258, |
57 | FMax2 = 259, | 57 | FMax2 = 259, |
58 | StopERP2 = 7 + 256, | ||
59 | StopCFM2 = 8 + 256, | ||
58 | LoStop3 = 512, | 60 | LoStop3 = 512, |
59 | HiStop3 = 513, | 61 | HiStop3 = 513, |
60 | Vel3 = 514, | 62 | Vel3 = 514, |
61 | FMax3 = 515 | 63 | FMax3 = 515, |
64 | StopERP3 = 7 + 512, | ||
65 | StopCFM3 = 8 + 512 | ||
62 | } | 66 | } |
63 | public class OdeCharacter : PhysicsActor | 67 | public class OdeCharacter : PhysicsActor |
64 | { | 68 | { |
@@ -560,12 +564,78 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
560 | } | 564 | } |
561 | else | 565 | else |
562 | { | 566 | { |
563 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, -0); | 567 | #region Documentation of capsule motor LowStop and HighStop parameters |
564 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0); | 568 | // Intentionally introduce some tilt into the capsule by setting |
565 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, -0); | 569 | // the motor stops to small epsilon values. This small tilt prevents |
566 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0); | 570 | // the capsule from falling into the terrain; a straight-up capsule |
567 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0); | 571 | // (with -0..0 motor stops) falls into the terrain for reasons yet |
568 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0); | 572 | // to be comprehended in their entirety. |
573 | #endregion | ||
574 | d.JointSetAMotorParam(Amotor, (int)dParam.LowStop, 0.08f); | ||
575 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop3, -0f); | ||
576 | d.JointSetAMotorParam(Amotor, (int)dParam.LoStop2, 0.08f); | ||
577 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop, 0.08f); // must be same as lowstop, else a different, spurious tilt is introduced | ||
578 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop3, 0f); // same as lowstop | ||
579 | d.JointSetAMotorParam(Amotor, (int)dParam.HiStop2, 0.08f); // same as lowstop | ||
580 | #region Documentation of capsule motor StopERP and StopCFM parameters | ||
581 | // In addition to the above tilt, we allow a dynamic tilt, or | ||
582 | // wobble, to emerge as the capsule is pushed around the environment. | ||
583 | // We do this with an experimentally determined combination of | ||
584 | // StopERP and StopCFM which make the above motor stops soft. | ||
585 | // The softness of the stops should be tweaked according to two | ||
586 | // requirements: | ||
587 | // | ||
588 | // 1. Motor stops should be weak enough to allow enough wobble such | ||
589 | // that the capsule can tilt slightly more when moving, to allow | ||
590 | // "gliding" over obstacles: | ||
591 | // | ||
592 | // | ||
593 | // .-. | ||
594 | // / / | ||
595 | // / / | ||
596 | // _ / / _ | ||
597 | // / \ .-. / / / \ | ||
598 | // | | ----> / / / / | | | ||
599 | // | | / / `-' | | | ||
600 | // | | / / +------+ | | | ||
601 | // | | / / | | | | | ||
602 | // | | / / | | | | | ||
603 | // \_/ `-' +------+ \_/ | ||
604 | // ---------------------------------------------------------- | ||
605 | // | ||
606 | // Note that requirement 1 is made complicated by the ever-present | ||
607 | // slight avatar tilt (assigned in the above code to prevent avatar | ||
608 | // from falling through terrain), which introduces a direction-dependent | ||
609 | // bias into the wobble (wobbling against the existing tilt is harder | ||
610 | // than wobbling with the tilt), which makes it easier to walk over | ||
611 | // prims from some directions. I have tried to minimize this effect by | ||
612 | // minimizing the avatar tilt to the minimum that prevents the avatar from | ||
613 | // falling through the terrain. | ||
614 | // | ||
615 | // 2. Motor stops should be strong enough to prevent the capsule | ||
616 | // from being forced all the way to the ground; otherwise the | ||
617 | // capsule could slip underneath obstacles like this: | ||
618 | // _ _ | ||
619 | // / \ +------+ / \ | ||
620 | // | | ----> | | | | | ||
621 | // | | | | | | | ||
622 | // | | .--.___ +------+ | | | ||
623 | // | | `--.__`--.__ | | | ||
624 | // | | `--.__`--. | | | ||
625 | // \_/ `--' \_/ | ||
626 | // ---------------------------------------------------------- | ||
627 | // | ||
628 | // | ||
629 | // It is strongly recommended you enable USE_DRAWSTUFF if you want to | ||
630 | // tweak these values, to see how the capsule is reacting in various | ||
631 | // situations. | ||
632 | #endregion | ||
633 | d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM, 0.0035f); | ||
634 | d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM2, 0.0035f); | ||
635 | d.JointSetAMotorParam(Amotor, (int)dParam.StopCFM3, 0.0035f); | ||
636 | d.JointSetAMotorParam(Amotor, (int)dParam.StopERP, 0.8f); | ||
637 | d.JointSetAMotorParam(Amotor, (int)dParam.StopERP2, 0.8f); | ||
638 | d.JointSetAMotorParam(Amotor, (int)dParam.StopERP3, 0.8f); | ||
569 | } | 639 | } |
570 | 640 | ||
571 | // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the | 641 | // Fudge factor is 1f by default, we're setting it to 0. We don't want it to Fudge or the |