On Win32, things are failing to build with messages like:
RenderableEntityItem.cpp(674,51): error C2065: 'M_PI': undeclared identifier
This is because as per Microsoft documentation, _USE_MATH_DEFINES is needed to
obtain constants like M_PI:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants?view=msvc-160
It seems this worked previously due to some quirk of CMake, but stopped working
after some reordering. This change makes this definition explicit where it is needed.
Changed the default value of FloatPreference::_step from 0.1f to 1, because FloatPreference::_decimals defaults to 0. Also because before this branch, all spinners used a step of 1 rather than SpinnerPreference::_step.
Spinners such as Settings > General > Desktop Tablet Scale / VR Tablet Scale work again.
This helps with log flooding. Successive repeated log messages will be skipped and counted,
the count will be output when a different message is logged.
A new option of 'keep_repeats' has been added to VIRCADIA_LOG_OPTIONS to disable this.
(https://github.com/vircadia/vircadia/issues/117)
- In SpinBoxPreference.qml, SpinBox was missing "realStepSize: preference.step".
- Had to change FloatPreference::step from float to double, because there is some truncation happening somewhere. For example, a step of 0.01f was acting like 0.00 because (0.01f < 0.01).
- Changed FloatPreference::decimals (number of decimal places) from float to uint, because it seemed to make more sense.
- Changed the 'User real-world height' spinbox to use a resolution of 1cm (for display and step) rather than 1mm.
- Remaining bug: the up & down buttons of the spinbox fail to change the value, at some values, though the mouse wheel always works. Repro:
Settings > Controls > User real-world height
Hover the mouse over the box and and scroll the mouse wheel down until the value is at 1.15.
Click the up button a few times and observe that the number can't be increased.
Scroll the mouse wheel forward and observe that the number increases correctly.
- Todo: Change all calls to FloatPreference::setStep to pass doubles, if this change to its parameter type is kept.
- Divided the option "Avatar leaning behavior" into two options that work more usefully: "Allow my avatar to stand" and "Allow my avatar to lean" (PreferencesDialog.cpp). Made the necessary fixes so that the avatar can be set to stand only when the user is standing (more details below).
- The logic controlling the direction of MyAvatar's action motor is now centralised in calculateScaledDirection (was previously split between there and updateMotors). calculateScaledDirection now returns a velocity in world space.
- CharacterController::FollowHelper now uses separate follow timers for rotation, horizontal and vertical (previously followed all three based on the longest of their follow times). Where appropriate, FollowHelper can now snap immediately to the desired rotation/horizontal/vertical independently (see FOLLOW_TIME_IMMEDIATE_SNAP).
- FollowHelper::FollowType has therefore moved to CharacterController::FollowType.
- MyAvatar::FollowHelper::postPhysicsUpdate: If MyAvatar is not allowed to stand when the user is sitting, this now avoids recentring the body based on the head height.
- Removed Q_PROPERTY(MyAvatar::SitStandModelType, as the sitting/standing/leaning model uses different enums now (see setAllowAvatarStandingPreference, setAllowAvatarLeaningPreference).
- Removed Q_PROPERTY(bool isSitStandStateLocked which is no longer used, because we now always track the user's real-world sit/stand state, regardless of what we're doing with it.
- MyAvatar::FollowHelper::shouldActivateHorizontal: If MyAvatar is not allowed to lean, this now returns true to recentre the footing if the head is outside the base of support.
- MyAvatar::FollowHelper::shouldActivateHorizontalCG: If MyAvatar is not allowed to lean, this now always returns true to recentre the footing. Rearranged to avoid computing values that weren't used depending on the conditions. Resolved some duplicated code.
- MyAvatar::setUserRecenterModel previously set HMDLeanRecenterEnabled based on the chosen mode, but it got reset when getting out of a sit. Now HMDLeanRecenterEnabled is only controlled by the scripts.
- Added Rig::getUnscaledHipsHeight (like getUnscaledEyeHeight). Refactored a little to avoid duplicated code. Added DEFAULT_AVATAR_HIPS_HEIGHT which is the value that Rig::getUnscaledHipsHeight returns when using the default avatar.
- Fix for recentring not behaving as requested by the user after getting up from click-to-sit (always behaving like 'Auto') : MyAvatar::endSit now passes false to centerBody for 'forceFollowYPos'.
- Fix for incorrect vertical position of the avatar and viewpoint after changing lean recentre mode while not standing in the real world: MyAvatar::setAllowAvatarStandingPreference now calls centerBody with false for 'forceFollowYPos'.
- computeHipsInSensorFrame: The code now matches the comments in that it only skips the dampening of the hips rotation if the centre-of-gravity model is being used.
Set VIRCADIA_LOG_OPTIONS to a string containing these keywords:
color
milliseconds
process_id
thread_id
The separator doesn't matter. Example:
$ export VIRCADIA_LOG_OPTIONS="color milliseconds"