Add support for teleportToEntity

Add support for teleportToEntity
This commit is contained in:
Alezia Kurdis 2020-10-18 22:59:08 -04:00 committed by GitHub
parent 9004251bcf
commit 3241ea7c1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -636,6 +636,16 @@ SelectionManager = (function() {
}
};
that.teleportToEntity = function() {
if (SelectionManager.hasSelection()) {
var distanceFromTarget = 3 + Math.max(Math.max(SelectionManager.worldDimensions.x, SelectionManager.worldDimensions.y), SelectionManager.worldDimensions.z);
var teleportTargetPosition = Vec3.sum(SelectionManager.worldPosition, Vec3.multiplyQbyV(MyAvatar.orientation, { x: 0, y: 0, z: distanceFromTarget }));
MyAvatar.goToLocation(teleportTargetPosition, false);
} else {
audioFeedback.rejection();
}
};
return that;
})();