Skip to content

Helper classes

bardsodal edited this page Dec 15, 2021 · 6 revisions

Introduction

There are two main helper classes to help with development with BDK. These are BdkLogger and TypeHelpers.

BdkLogger

BdkLogger is a static class that allows the developer to log debug, warning and error logs in the HoloLens. This class is best used in combination with the script LogToTextComponent, that allows the debug and error messages to be displayed in the HoloLens. Below are a description of the most important methods in BdkLogger.

Log

Log allows the developer to log any information they want. The log may be passed a LogSeverity parameter which allows the logs to be filtered by severity if desired.

LogException

Logs an exception with a custom message as well as the error message.

LogToTextComponent

Script that allows the user to log debug and exception logs to a text mesh pro object. Useful for debugging, but should not be used for production builds as it is not optimized for that.

TypeHelpers

TypeHelpers is a static class that allows the developer to easily convert between Unity variables and System variables. The hand tracking input is based in the System framework and need to be converted to Unity variables to be used correctly in Unity.

MakeUnityVector3

Converts a System.Numerics.Vector3 to a UnityEngine.Vector3.

MakeUnityQuaternion

Converts a System.Numerics.Quaternion to a UnityEngine.Quaternion.

MakeSystemVector3

Converts a UnityEngine.Vector3 to a System.Numerics.Vector3.

MakeSystemQuaternion

Converts a UnityEngine.Quaternion to a System.Numerics.Quaternion.

SystemMessageController (WIP)

Allows to send notifications to the user. These messages appear in front of the user and are dynamically timed and removed after a while.

AddMessage (WIP)

AddMessage allows you to send a string that will be displayed as a notification to the player.