Commit graph

84302 commits

Author SHA1 Message Date
HifiExperiments
2667af3682 more safeguards 2021-01-20 21:25:30 -08:00
HifiExperiments
3335c040e5 hurr durr I'm an idiot 2021-01-18 18:39:12 -08:00
HifiExperiments
4bf952260f fix crashes when running with qml disabled in VR 2021-01-18 12:57:44 -08:00
daleglass
06b1a8e17c
Merge pull request #928 from Phil-Palmer/fix/vr-recenter
VR fixes for: couldn't sit on the floor, wrong walk directions.
2021-01-16 20:51:03 +01:00
Kalila
76b7b51e68
Merge pull request #517 from vircadia/dependabot/npm_and_yarn/screenshare/electron-7.2.4
Bump electron from 6.0.12 to 7.2.4 in /screenshare
2021-01-16 14:16:34 -05:00
Phil Palmer
265aeb7652 Merge branch 'fix/vr-recenter' of https://github.com/Phil-Palmer/project-athena into fix/vr-recenter 2021-01-04 15:55:54 -05:00
Phil Palmer
a54a40dc2c Apply suggestion from code review: fix debug message. 2021-01-04 15:55:34 -05:00
Phil Palmer
9f84b8384e Apply suggestion from code review: fix JSDoc comment. 2021-01-04 15:49:26 -05:00
Phil Palmer
5d1bd5cc19 * Apply suggestions from code review
Fix JSDoc comments and debug messages.
2021-01-04 00:57:17 -05:00
Phil
646a5798e6
Apply suggestions from code review
Tidying (bracing style, spaces, remove final comma from enum, fix JSDoc comments).

Co-authored-by: David Rowe <david@ctrlaltstudio.com>
2021-01-04 00:12:57 -05:00
Phil Palmer
3cc08022fc Leaning and lean recentering now work as intended at any avatar scale.
Individually tested each of these scale fixes in third-person view.
Simplify withinBaseOfSupport.
Change input parameter from float& to float (isWithinThresholdHeightMode).
Debug: remove unnecessary Y offset that didn't scale properly with the avatar (drawBaseOfSupport).
2020-12-31 05:09:06 -05:00
Phil Palmer
4a0bde415b Fix an old confusing comment from 952b112271 2020-12-31 00:06:25 -05:00
Phil Palmer
ba5bea15b6 Merge branch 'fix/vr-recenter' of https://github.com/Phil-Palmer/project-athena into fix/vr-recenter 2020-12-30 23:16:30 -05:00
Phil Palmer
c5fe49bc30 Decouple MyAvatar.centerOfGravityModelEnabled from the user standing state.
Engine code no longer controls MyAvatar.centerOfGravityModelEnabled.  Maybe we should deprecate it now, since its reason to exist seemed to be only to disable the CG model while the user was sitting, which is now done more explicitly (see below).

MyAvatar::FollowHelper:
- rename shouldActivateHorizontal to shouldActivateHorizontal_userSitting, now private.
- rename shouldActivateHorizontalCG to shouldActivateHorizontal_userStanding, now private.
- add new shouldActivateHorizontal that calls one of the above based on the user's sit/stand state.
- these functions no longer modify their 'myAvatar' parameter.

Add USER_CAN_TURN_BODY_WHILE_SITTING (false), which retains the old rotation behaviour of lean recentering:
a lean recenter doesn't rotate the body if the user is sitting (new: unless the feet are tracked).
In other words, the lean recentering assumes the user isn't on a swivel chair and keeps the avatar pointing in the same direction.  It might be good to expose that as an option.  (Regardless, rotation recentering does kick-in if they turn too far).
2020-12-30 23:14:42 -05:00
Phil Palmer
dd2a11f53b Decouple MyAvatar.centerOfGravityModelEnabled from the user standing state.
Engine code no longer controls MyAvatar.centerOfGravityModelEnabled.  Maybe we should deprecate it now, since its reason to exist seemed to be only to disable the CG model while the user was sitting, which is now done more explicitly (see below).

MyAvatar::FollowHelper:
- rename shouldActivateHorizontal to shouldActivateHorizontal_userSitting, now private.
- rename shouldActivateHorizontalCG to shouldActivateHorizontal_userStanding, now private.
- add new shouldActivateHorizontal that calls one of the above based on the user's sit/stand state.
- these functions no longer modify their 'myAvatar' parameter.

Add USER_CAN_TURN_BODY_WHILE_SITTING (false), which retains the old rotation behaviour of lean recentering:
a lean recenter doesn't rotate the body if the user is sitting (new: unless the feet are tracked).
In other words, the lean recentering assumes the user isn't on a swivel chair and keeps the avatar pointing in the same direction.  It might be good to expose that as an option.  (Regardless, rotation recentering does kick-in if they turn too far).
2020-12-30 22:38:31 -05:00
Phil Palmer
a95d29d327 Fix leaning not using center-of-gravity model in mode 'Allow avatar to stand: When I'm standing'.
computeHipsInSensorFrame was accidentally setting useCenterOfGravityModel to false if !getHMDCrouchRecenterEnabled.  Now it sets it to true if !getHMDCrouchRecenterEnabled.  So if artificial standing is disabled, it uses center-of-gravity regardless of the user's sit/stand state.
2020-12-30 21:36:24 -05:00
Phil Palmer
44324584b4 Fix accidental change of bracing style. 2020-12-30 04:30:52 -05:00
Phil Palmer
976ed2b1d3 Merge branch 'fix/vr-recenter' of https://github.com/Phil-Palmer/project-athena into fix/vr-recenter 2020-12-30 04:22:16 -05:00
Phil Palmer
8d3e2ae9ee Remove MyAvatar "squat" recenter from ad6bbc7ff6
The "squat" recenter pre-dates the sit/stand detection, but the current version basically came from ad6bbc7ff6 in 2018.  I'm removing it because it doesn't seem useful anymore (with or without the other changes in this branch).

What it did (on the current master) :
- If "Avatar leaning behavior" was "Auto"
- and the user was standing
- but their head was more than 5cm below standing height
- and their chest was upright
- for 30 seconds
- do a vertical recenter so that the avatar stands straight (instead of having knees bent).
When the user stood up straight after that recenter, the avatar would hover off the ground until the next recenter (eg. walking).
2020-12-30 04:21:24 -05:00
Phil Palmer
ee0904d561 Remove MyAvatar "squat" recenter from ad6bbc7ff6
The "squat" recenter pre-dates the sit/stand detection, but the current version basically came from ad6bbc7ff6 in 2018.  I'm removing it because it doesn't seem useful anymore (with or without the other changes in this branch).

What it did (on the current master) :
- If "Avatar leaning behavior" was "Auto"
- and the user was standing
- but their head was more than 5cm below standing height
- and their chest was upright
- for 30 seconds
- do a vertical recenter so that the avatar stands straight (instead of having knees bent).
When the user stood up straight after that recenter, the avatar would hover off the ground until the next recenter (eg. walking).
2020-12-30 04:13:37 -05:00
Kalila
165537a4eb
Merge pull request #944 from HifiExperiments/physicsFix
Possible fix for bad physics performance
2020-12-30 03:04:17 -05:00
Phil Palmer
8cf7660993 Replace a tab with spaces. 2020-12-30 02:00:28 -05:00
Phil Palmer
8ca6421376 Correct the name of a scale factor (had inverted meaning). 2020-12-30 01:56:05 -05:00
Phil Palmer
cba79c72f5 Re-added API features that are no longer used internally; marked them as deprecated.
As suggested in the review here: https://github.com/vircadia/vircadia/pull/928/files#r549821976

Re-added and deprecated MyAvatar.userRecenterModel.  Retained the functionality of setUserRecenterModel, and approximated that of getUserRecenterModel (some stand+lean preference pairs had no equivalent before).

Re-added and deprecated MyAvatar.isSitStandStateLocked.  Approximated the functionality of getIsSitStandStateLocked.
Didn't retain that of setIsSitStandStateLocked, because it wouldn't be useful on its own; someone using it would probably want setUserRecenterModel instead (or new functions to set the standing and leaning preferences).

isSitStandStateLocked's reason to exist was that we could stop keeping track of the user's real-world sit/stand state (in updateSitStandState), and instead pretend the user was always standing (for SitStandModelType::ForceStand) or always sitting (for SitStandModelType::ForceSit).
That determined whether the avatar was allowed to lean (wouldn't lean if the user was sitting or in ForceSit).
Now though, the user explicitly chooses when the avatar may lean: never / just when the user is standing / even when the user is sitting.

These API features were removed in 2179c153de ("VR fixes for: couldn't sit on the floor, wrong walk directions").
2020-12-30 01:01:35 -05:00
Phil Palmer
8c7c91ed6f Remove const from variable declarations as suggested in the review.
Suggested here: https://github.com/vircadia/vircadia/pull/928/files#r549830690

The ones I've left are either
- values known at compile time, eg. const float MIN_LENGTH_FOR_NORMALIZE = 0.061f;
- consts that were already there in the previous code, eg. const float MAX_DISPLACEMENT = 0.5f * _radius;
2020-12-29 19:31:35 -05:00
Phil Palmer
d49cdfff6b Remove accidental change of style in a variable declaration. 2020-12-29 18:31:42 -05:00
Phil
7e5680b2a6
Apply suggestions from code review
Tidying (bracing style, spaces, remove final comma from enum, fix JSDoc comment).

Co-authored-by: David Rowe <david@ctrlaltstudio.com>
2020-12-29 18:25:17 -05:00
HifiExperiments
0f9f95f716 possible fix for physics 2020-12-28 23:46:37 -08:00
Phil Palmer
1e54d41f95 Remove static variable from MyAvatar::update (made it a member). 2020-12-28 05:37:06 -05:00
Phil Palmer
2be87fe7dc Fix VR recentering cases that gave incorrect vertical position.
Fix for MyAvatar sometimes hovering off the ground after foot tracking was enabled.  MyAvatar's body is now recentered when foot-tracking starts or ends (in MyAvatar::update).
Repro:
- Start without foot tracking, 'Allow my avatar to stand: Always'.
- Crouch, and wait a few seconds for the avatar to pop back to the standing position.
- Slowly stand straight so that the avatar raises off the ground without recentering (PS: is this a bug?).  If it recenters, retry from previous step.
- Calibrate foot tracking.  Previously the avatar would remain hovering off the ground until MyAvatar::centerBody was called.

Fix for MyAvatar popping to a standing position if the left foot lost tracking.  The recentering now takes into account if either of the feet are tracked.
Repro:
- Enable foot tracking (and ideally hips tracking).
- Sit on the floor.
- Cover the left foot sensor so it loses tracking.  Previously the avatar and viewpoint would pop to a standing position.

Optimisation: MyAvatar::update now stores bools indicating which body parts are tracked (_isBodyPartTracked).  This avoid unnecessary computations that came from using getControllerPoseInAvatarFrame to convert controller::Pose from sensor space to world space and then to avatar space, only to check if the pose was valid.
2020-12-27 22:13:09 -05:00
Phil Palmer
3e25e32f18 Revert temporary "added pragmas" (optimize off)
This reverts commit 20e4f952ab.
2020-12-27 02:52:52 -05:00
Phil Palmer
dec9e9d338 VR fix for different avatar scales.
Previously, if the avatar scale wasn't 1, the body and viewpoint would given the wrong vertical position in some situations, eg: getting up from click-to-sit; changing the 'Allow my avatar to stand' setting.
The avatar scale was being taken into account where it shouldn't have in MyAvatar::deriveBodyFromHMDSensor.
The bug started in 8b839fe71b ("VR fixes for different user heights and avatar scales".
Repro:
1. Set 'Allow my avatar to stand: Always'
2. Reduce the avatar scale to the minumum.
3. Set 'Allow my avatar to stand: When I stand'
4. Previously, the viewpoint would suddenly be below the floor.
2020-12-27 02:50:29 -05:00
Phil Palmer
c9cf7eb75d Merge branch 'fix/vr-recenter-PRAGMAS' into fix/vr-recenter 2020-12-26 23:22:16 -05:00
Phil Palmer
20e4f952ab added pragmas 2020-12-26 23:19:21 -05:00
daleglass
f894a0a141
Merge pull request #877 from vircadia/feature/domain-server-reporting-socket
Send address and port with each metaverse heartbeat.
2020-12-26 20:40:58 +01:00
Kalila
df1feaf4f1
Merge pull request #907 from AleziaKurdis/CreateApp_DEC2020_Material_Icons
Create app dec2020 material icons
2020-12-24 17:24:33 -05:00
Phil Palmer
a489e9ddca Code style: made some little things more conformant with the coding standards and the rest of the codebase.
https://github.com/vircadia/vircadia/blob/master/CODING_STANDARD.md
2020-12-23 19:00:05 -05:00
Phil Palmer
8b839fe71b VR fixes for different user heights and avatar scales.
- The user's real-world height is now taken into account in MyAvatar::deriveBodyFromHMDSensor.  Therefore, for any user height, the floor stays correctly positioned in all modes of 'Allow my avatar to stand'.
- Whenever the user's real-world height is changed, centerBodyInternal is now called to position the body accordingly.  The floor therefore stays correctly positioned in all modes of 'Allow my avatar to stand'.  (MyAvatar::setUserHeight)
- Fix for walk speeds in VR being too fast at large avatar scale and too slow at small avatar scale.  The action motor velocity was being scaled once too many by the sensor-to-world scale.  The bug existed before this branch.  (MyAvatar::scaleMotorSpeed)
2020-12-23 07:54:59 -05:00
Phil Palmer
287f710ea1 Fix MyAvatar::centerBody breaking existing scripts (eg. away.js) by having a new parameter:
Moved the body of the function to a private internal method (centerBodyInternal), which takes the parameter instead.
Previously, when leaving 'away' state, the 'Away' overlay would stay on screen because of the bug.
The bug started in "VR fixes for: couldn't sit on the floor, wrong walk directions." (2179c153de).
2020-12-22 19:32:43 -05:00
Phil Palmer
6fc40385ca Fix compile error building macOS-latest: changed MINIMUM_TIME_REMAINING from const to constexpr in CharacterController::playerStep.
Error was: "static_assert expression is not an integral constant expression", "read of non-constexpr variable 'MINIMUM_TIME_REMAINING' is not allowed in a constant expression".
Error started in last commit (2179c153de).
2020-12-22 15:51:03 -05:00
Phil Palmer
2179c153de VR fixes for: couldn't sit on the floor, wrong walk directions.
- 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.
2020-12-22 14:22:27 -05:00
Kalila
f1576aba78
Merge pull request #824 from ctrlaltdavid/fix/interface-console
Remove "Console" options from Interface-only installer (Windows)
2020-12-20 16:34:25 -05:00
David Rowe
71cee734ec Merge branch 'master' into fix/interface-console
# Conflicts:
#	README.md
2020-12-18 19:44:20 +13:00
Alezia Kurdis
7ff8236da2
Minor Code Adjustments
Minor Code Adjustments
2020-12-17 22:07:11 -05:00
Kalila
89d1346644
Merge pull request #919 from ArcadeFever/fix/upgrade-android-oculus-sdk-23.0.0.1-and-1.37.0
Upgraded Oculus Mobile and Platform SDKs to latest (1.37.0 and 23.0.0)
2020-12-17 20:24:37 -05:00
Kalila
f1c9614076
Merge pull request #917 from JulianGro/gles
Fix building with GLES 3.2 on Linux
2020-12-17 20:23:26 -05:00
Kalila
2d22f9a395
Merge pull request #908 from ctrlaltdavid/fix/update-links
Update GitHub links
2020-12-16 22:13:44 -05:00
Kalila
1b26220655
Merge pull request #916 from vegaslon/documentation/contributing
Add Tips for making pull request to CONTRIBUTING.md
2020-12-16 20:37:25 -05:00
Adam Ivie
3a7195c21c
Remove artifact from resolving conflict
Co-authored-by: Kalila <69767640+digisomni@users.noreply.github.com>
2020-12-16 18:37:19 -05:00
Julian Groß
b416ca1e17 Simplify code according to review 2020-12-16 16:50:54 +01:00