@viewar/guide
Advanced tools
Comparing version 0.11.2 to 0.11.3
{ | ||
"name": "@viewar/guide", | ||
"version": "0.11.2", | ||
"version": "0.11.3", | ||
"description": "ViewAR Guide", | ||
@@ -5,0 +5,0 @@ "main": "dist/viewar-guide.js", |
@@ -89,19 +89,15 @@ import Vector3 from '../../math/vector3' | ||
let previousPosition; | ||
if (previous === NO_WAYPOINT) { | ||
// Use the guide's initial pose if there is no previous waypoint. | ||
previousPosition = body.initialPose.position.clone(); | ||
} else { | ||
previousPosition = new Vector3(previous.pose.position); | ||
} | ||
if (previous !== NO_WAYPOINT) { | ||
const previousPosition = new Vector3(previous.pose.position); | ||
let guidePosition = projectPointOnEdge(normalizeYPosition(position), [normalizeYPosition(currentPosition), normalizeYPosition(previousPosition)]); | ||
let guidePosition = projectPointOnEdge(normalizeYPosition(position), [normalizeYPosition(currentPosition), normalizeYPosition(previousPosition)]); | ||
if (guidePosition) { | ||
const totalDistance = currentPosition.clone().subtract(previousPosition).length(); | ||
const distance = guidePosition.clone().subtract(previousPosition).length(); | ||
if (guidePosition) { | ||
const totalDistance = currentPosition.clone().subtract(previousPosition).length(); | ||
const distance = guidePosition.clone().subtract(previousPosition).length(); | ||
const heightDiff = currentPosition.y - previousPosition.y; | ||
let height = previousPosition.y + heightDiff / totalDistance * distance; | ||
return { success: true, height }; | ||
const heightDiff = currentPosition.y - previousPosition.y; | ||
let height = previousPosition.y + heightDiff / totalDistance * distance; | ||
return { success: true, height }; | ||
} | ||
} | ||
@@ -108,0 +104,0 @@ } |
Sorry, the diff of this file is too big to display
193150
2672