diff options
author | teravus | 2012-10-03 02:30:23 -0400 |
---|---|---|
committer | teravus | 2012-10-03 02:30:23 -0400 |
commit | e56ef2720ecd603c9b3c81cbb7c3a0d49d24bf85 (patch) | |
tree | 0eadc9f514dc5e0372f26204c51a229101bfd9cc /OpenSim | |
parent | Minor Modification, switch /2 to 0.5f in ODEPrim.Velocity (diff) | |
download | opensim-SC-e56ef2720ecd603c9b3c81cbb7c3a0d49d24bf85.zip opensim-SC-e56ef2720ecd603c9b3c81cbb7c3a0d49d24bf85.tar.gz opensim-SC-e56ef2720ecd603c9b3c81cbb7c3a0d49d24bf85.tar.bz2 opensim-SC-e56ef2720ecd603c9b3c81cbb7c3a0d49d24bf85.tar.xz |
I propose that 0.5m/step change for linear velocity is too big of a change to control the reporting of a new angular velocity. I think that this could be here for one of two reasons, 1. vehicles and llMoveToTarget with axis lock, or 2. To attempt to make things look more stable in the physics scene then they really are, however, this also really affects the angular velocity reporting negatively causing things to spin wildly and jump back into place repeatedly. To compromise, if the prim is a vehicle or is being used as a motor target, the original functionality is still applied. If that's not the case, angular velocity is reported with a linear velocity of 0.02m/step. To be clear on the effect of the physical world... When you push things, there's still a lag time where you walk into the object but once the object is in motion, it begins to move as you would expect so results in slightly more realistic motion.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 3056f67..1b47754 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -2600,6 +2600,7 @@ Console.WriteLine(" JointCreateFixed"); | |||
2600 | { | 2600 | { |
2601 | Vector3 pv = Vector3.Zero; | 2601 | Vector3 pv = Vector3.Zero; |
2602 | bool lastZeroFlag = _zeroFlag; | 2602 | bool lastZeroFlag = _zeroFlag; |
2603 | float m_minvelocity = 0; | ||
2603 | if (Body != (IntPtr)0) // FIXME -> or if it is a joint | 2604 | if (Body != (IntPtr)0) // FIXME -> or if it is a joint |
2604 | { | 2605 | { |
2605 | d.Vector3 vec = d.BodyGetPosition(Body); | 2606 | d.Vector3 vec = d.BodyGetPosition(Body); |
@@ -2752,8 +2753,21 @@ Console.WriteLine(" JointCreateFixed"); | |||
2752 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); | 2753 | _acceleration = ((_velocity - m_lastVelocity) / 0.1f); |
2753 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); | 2754 | _acceleration = new Vector3(_velocity.X - m_lastVelocity.X / 0.1f, _velocity.Y - m_lastVelocity.Y / 0.1f, _velocity.Z - m_lastVelocity.Z / 0.1f); |
2754 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); | 2755 | //m_log.Info("[PHYSICS]: V1: " + _velocity + " V2: " + m_lastVelocity + " Acceleration: " + _acceleration.ToString()); |
2756 | |||
2757 | // Note here that linearvelocity is affecting angular velocity... so I'm guessing this is a vehicle specific thing... | ||
2758 | // it does make sense to do this for tiny little instabilities with physical prim, however 0.5m/frame is fairly large. | ||
2759 | // reducing this to 0.02m/frame seems to help the angular rubberbanding quite a bit, however, to make sure it doesn't affect elevators and vehicles | ||
2760 | // adding these logical exclusion situations to maintain this where I think it was intended to be. | ||
2761 | if (m_throttleUpdates || m_usePID || (m_vehicle != null && m_vehicle.Type != Vehicle.TYPE_NONE) || (Amotor != IntPtr.Zero)) | ||
2762 | { | ||
2763 | m_minvelocity = 0.5f; | ||
2764 | } | ||
2765 | else | ||
2766 | { | ||
2767 | m_minvelocity = 0.02f; | ||
2768 | } | ||
2755 | 2769 | ||
2756 | if (_velocity.ApproxEquals(pv, 0.5f)) | 2770 | if (_velocity.ApproxEquals(pv, m_minvelocity)) |
2757 | { | 2771 | { |
2758 | m_rotationalVelocity = pv; | 2772 | m_rotationalVelocity = pv; |
2759 | } | 2773 | } |