Skip to content

Commit

Permalink
Review Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
SrinivasPrabhu794 committed Feb 21, 2021
1 parent 5ecc680 commit 8431b8f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/js/xr/src/use-interactions-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -764,19 +764,19 @@ const useInteractionsManager = ({
let worldScale = useStoreApi.getState().worldScale
let hmd = camera.parent
let elevationDisplacement = 0.5
//Value of -1.6 is used since the XR camera is already 1.6 mtrs above the ground by default.
let minHeight = -1.6;
// Value of -2.6 is used since the XR camera is already 1.6 mtrs above the ground by default.
let minHeight = -2.6

if (event.target.uuid === rightController.uuid) {
if ( event.target.uuid === rightController.uuid ) {
hmd.position.y += elevationDisplacement
} else {

//This makes sure that the camera moves upto 1mtr below the surface
if (hmd.position.y > minHeight) {
// This makes sure that the camera moves upto 1mtr below the surface
if ( hmd.position.y > minHeight ) {
hmd.position.y -= elevationDisplacement
//Clamp the value to 1.6mtrs below the ground in case the y values becomes lesser.
if(hmd.position.y < minHeight)
// Clamp the value to 2.6mtrs below the ground in case the y values becomes lesser.
if( hmd.position.y < minHeight ) {
hmd.position.y = minHeight
}
}
}

Expand Down

0 comments on commit 8431b8f

Please sign in to comment.