secondlife / viewer

🖥️ Second Life's official client
GNU Lesser General Public License v2.1
208 stars 53 forks source link

[Featurettes] Regression in anti-flipping mechanism for mouselook camera #1611

Open Martin-Pitt opened 3 months ago

Martin-Pitt commented 3 months ago

Environment

Second Life Release 7.1.8.9103842320 (64bit) - Materials Featurettes

Description

The code related to up/down camera limits were changed which causes a regression and causes a error where the user can end up flipping their camera upside down and also causes issues with the limits being applied at the wrong place.

Here is an unlisted video recording reproducing the issue: https://www.youtube.com/watch?v=ObZnP_t8PpM My tank is a linden vehicle of type car with flags (VEHICLE_FLAG_LIMIT_MOTOR_UP|VEHICLE_FLAG_NO_DEFLECTION_UP that allows for tilting the camera relative to the vehicle.

This issue would affect any vehicle where the camera is fixed to roll relative to the vehicle. It is just significantly noticeable and a massive issue for my project which I've been working on for about 15 years.

I was also able to replicate the issue more severely in Kart 1.0 from the Library inventory where it doesn't clamp the look up at all. EDIT: I think this is because the sit target is a bit tilted rather than at ZERO_ROTATION; In current viewers it would have the max limit tilted with respect to the sit target, but in featurettes you can end up flipping your camera instead.

The relevant commit might be f815b015cecda18098dd2d16f65682a37e1bff7c after going through previous revisions and trying to find any changes to the camera clamping behaviour. Recommend reverting changes by this commit to llagent.cpp or fixing it carefully, the logic may seem simple but it is more complex.

Reproduction steps

All with the 7.1.8.9103842320 materials featurettes viewer, or alternatively the firestorm alpha/beta viewer.

  1. Vehicle which can tilt your camera, such driving a car or tank in mouselook and you are tilted on a very steep ramp/surface
  2. Try to keep looking up until you flip

Alternatively

  1. Visit Vertical Sim bottom ramp
  2. Try one of the [VS] Main Battle Tank 16 vehicles
  3. Drive up the ramp into the vertical sim cylinder level
  4. Try to move camera such as looking upwards to flip the camera or along the front towards the other end of the cylinder

Vehicles that have a rotated sit target:

  1. Rez and sit in a chair or vehicle that has a tilted sit target, like Kart 1.0 from the Library
  2. Try to keep looking up until you flip

Any sit target with an object that is rotated:

  1. Rez a cube and script it with a sit target such as llSitTarget(<0,0,1>, ZERO_ROTATION);
  2. Sit on the cube
  3. Rotate the cube at an angle, such as <0,315,0> (45 degrees backwards)
  4. Go into mouselook and look up
akleshchev commented 3 months ago

Related: https://github.com/secondlife/viewer/pull/1055 https://github.com/secondlife/viewer/pull/235 and https://github.com/secondlife/viewer/pull/1240

akleshchev commented 3 months ago

There is a newer fix in maint-c which might affect this https://github.com/secondlife/viewer/pull/1327

LLGuru commented 3 months ago

Fixed in https://github.com/secondlife/viewer/pull/1740