HoloLens Development

Holobuild Library version: 2.3



Getting started with Javascript HoloLens development using the buildWagon platform.


Core Components

To be able to display anything on a HoloLens we need three things: a HoloCamera, a HoloSpace, and a HoloRenderer.

HoloCamera

A HoloCamera represents the HoloLens and where it is looking at.
To create a new HoloCamera instance you can call: HoloBuild.HoloCamera();

Properties
  • children

    Returns an array of the HoloCamera's children.

  • position

    Represent the HoloCamera's local position.

  • rotation

    Represent the HoloCamera's local rotation (in radians).

  • scale

    Represent the HoloCamera's local scale.

Methods
  • add (object)

    Add a child object to the HoloCamera.

  • getObjectById (id)

    Searches through the HoloCamera's children and returns the object with a matching id.

  • getObjectByName
    (name)

    Searches through the HoloCamera's children and returns the object with a matching name.

  • getWorldPosition ()

    Returns a vector representing the position of the HoloCamera in the world space.

  • getWorldRotation ()

    Returns a vector representing the rotation of the HoloCamera in the world space.

  • getWorldDirection ()

    Returns a vector representing the direction of where the HoloCamera, i.e.: HoloLens user, is looking in the world space.

  • remove (object)

    Removes a child object from the HoloCamera.

HoloCursor of the HoloCamera
  • HoloCursor


    HoloCursor

    The HoloCursor is the a default HoloCamera child that is added by the system. A HoloCursor is a gaze indicator that provides continuous feedback for the HoloLens user about their intentions. The HoloCursor work by following the hololens's position and rotation in addition to casting a ray from the HoloLens into the HoloSpace object to show the user the center of their gaze and to indicate what hologram will respond to the user's input. The cursor will move with the user's head movement and it will lock in depth to whatever hologram or surface the user can is looking at. The cursor is torus shaped and it will provide a visual feedback per user hand state, for example, the cursor will change its shape base on the HoloLens detected the user's hand in the ready position and return to its normal shape when idle.

HoloCamera
To create a HoloCamera and set it to a variable:
var hololens = new HoloBuild.HoloCamera();
                       
To add a child object to the HoloCamera, in the case you want to follow the user's gaze:
var hololens = new HoloBuild.HoloCamera(); 
hololens.add(object);
                                    
To get a vector representing where the HoloLens user, is looking in the world space, you can use the getWorldDirection as follows:
var hololens = new HoloBuild.HoloCamera();
var vector = hololens.getWorldDirection();
                                    

HoloSpace

A HoloSpace represents a holographic scene, and its main purpose is to act as a container for all the holograms that make up the scene.

Properties
  • children

    Returns an array of the HoloSpace's children.

  • id

    A unique HoloSpace numeric identifier (readonly).

  • name

    Represent the HoloSpace's name.

  • position

    Represent the HoloSpace's local position.

  • rotation

    Represent the HoloSpace's local rotation (in radians).

  • scale

    Represent the HoloSpace's local scale.

  • visible

    if set to false the HoloSpace and all its content would not get rendered.

Methods
  • add (object)

    Add a child object to the HoloSpace.

  • clone ()

    Returns a clone of this HoloSpace.

  • getObjectById (id)

    Searches through the HoloSpace's children and returns the object with a matching id.

  • getObjectByName
    (name)

    Searches through the HoloSpace's children and returns the object with a matching name.

  • getWorldPosition ()

    Returns a vector representing the position of the HoloSpace in the world space.

  • getWorldRotation ()

    Returns a vector representing the rotation of the HoloSpace in the world space.

  • getWorldScale ()

    Returns a vector representing the scaling factors applied to the HoloSpace in the world space.

  • getWorldDirection ()

    Returns a vector representing the direction of HoloSpace's positive z-axis in the world space.

  • remove (object)

    Removes a child object from this HoloSpace.

  • toJSON ()

    Convert the HoloSpace to JSON format.

HoloSpace
var holoscene = new HoloBuild.HoloSpace();
                       

HoloRenderer

The HoloRenderer's main purpose is to render the content of the holographic scene into the HoloLens using WebGL. To render the holoscene onto the HoloLens, you will need to call the render function of the HoloRenderer and give it the scene and the hololens as inputs.
HoloRenderer
var holorenderer = new HoloBuild.HoloRenderer();
holorenderer.render(holoscene, hololens);
                       
To render a scene into the hololens:
var hololens = new HoloBuild.HoloCamera();
var holoscene = new HoloBuild.HoloSpace();
var holorenderer =  new HoloBuild.HoloRenderer();
holorenderer.render(holoscene, hololens);
                       

Geometries

The geometry is the shape that you want to draw, it contains all the polygons information that make up a hologram. In addition to creating your own geometry, there is a set of prebuilt geometries that you can use. This section will go over the pre-build geometries: such as a Box, or a Sphere.

HoloBoxGeometry

The HoloBoxGeometry is a geometry of a 3 dimensional box or a cube. To construct a HoloBoxGeomtry you need to provided the width, height, and box depth dimensions.

Constructor
  • width

    A number representing the width of the box in meters.

  • height

    A number representing the height of the box in meters.

  • depth

    A number representing the depth of the box in meters.

HoloBoxGeometry
var box = new HoloBuild.HoloBoxGeometry( 0.1, 0.1, 0.1 );
                       

HoloCircleGeometry

The HoloCircleGeometry is a simple circle geometry made of several triangular segments. To construct a HoloCircleGeomtry you need to provided the radius dimension.

Constructor
  • radius

    A number representing the circle radius in meters.

  • segments

    A number representing the number of triangular segments the circle will be made of.

HoloCircleGeometry
var circle = new HoloBuild.HoloCircleGeometry( 0.1, 30 );
                       

HoloConeGeometry

The HoloConeGeometry is a 3D cone geometry made of several triangular segments. To construct a HoloConeGeomtry you need to provided the cone radius and its height dimensions.

Constructor
  • radius

    A number representing the circle radius in meters.

  • radialSegments

    A number representing the number of radial segments the cone will be made of.

  • heightSegments

    A number representing the number of height segments the cone will be made of.

HoloConeGeometry
var cone = new HoloBuild.HoloConeGeometry( 0.1, 30, 30 );
                       

HoloCylinderGeometry

The HoloCylinderGeometry is a 3D cylinder geometry made of several triangular segments. To construct a HoloCylinderGeometry you need to provided the cylinder top radius, bottom radius, and its height dimensions.

Constructor
  • radiusTop

    A number representing the cylinder top radius in meters.

  • radiusBottom

    A number representing the number of bottom radius in meter.

  • height

    A number representing the height of the cylinder.

  • radialSegments

    A number representing the number of radial segments the cylinder will be made of.

  • heightSegments

    A number representing the number of height segments the cylinder will be made of.

HoloCylinderGeometry
var cylinder = new HoloBuild.HoloCylinderGeometry( 0.1, 0.1, 0.1, 30, 30 );
                       

HoloDodecahedronGeometry

The HoloDodecahedronGeometry is a 3D dodecahedron geometry made of several triangular segments. To construct a HoloDodecahedronGeometry you need to provided the dodecahedron radius.

Constructor
  • radius

    A number representing the dodecahedron radius in meters.

HoloDodecahedronGeometry
var Dodecahedron = new HoloBuild.HoloDodecahedronGeometry( 0.1);
                       

HoloIcosahedronGeometry

The HoloIcosahedronGeometry is a 3D Icosahedron geometry made of several triangular segments. To construct a HoloIcosahedronGeometry you need to provided the Icosahedron radius.

Constructor
  • radius

    A number representing the Icosahedron radius in meters.

HoloIcosahedronGeometry
var Icosahedron = new HoloBuild.HoloIcosahedronGeometry(1);
                       

HoloOctahedronGeometry

The HoloOctahedronGeometry is a 3D octahedron geometry made of several triangular segments. To construct a HoloOctahedronGeometry you need to provided the octahedron radius.

Constructor
  • radius

    A number representing the octahedron radius.

HoloOctahedronGeometry
var Octahedron = new HoloBuild.HoloOctahedronGeometry(1);
                       

HoloPlaneGeometry

The HoloPlaneGeometry is a 3D plane geometry made of several triangular segments. To construct a HoloPlaneGeometry you need to provided the plan width and height.

Constructor
  • width

    A number representing the plane width in meters.

  • height

    A number representing the plane height in meters.

  • HSegments

    The number of the plane horizontal segments (optional).

  • VSegments

    The number of the plane vertical segments (optional).

HoloPlaneGeometry
var Plane = new HoloBuild.HoloPlaneGeometry(0.1,0.1);
                       

HoloRingGeometry

The HoloRingGeometry is a 3D ring geometry made of several triangular segments. To construct a HoloRingGeometry you need to provided the ring innerRadius and OuterRadius.

Constructor
  • innerRadius

    A number representing the ring inner radius.

  • outerRadius

    A number representing the ring o uter radius.

  • Round

    The number of the ring outer segments making it more or less round (optional).

  • PSegments

    The number of the ring segments (optional).

HoloRingGeometry
var Plane = new HoloBuild.HoloRingGeometry(0.1, 0.5);
                       

HoloSphereGeometry

The HoloSphereGeometry is a geometry of a sphere . To construct a HoloSphereGeomtry you need to provided the sphere radius.

Constructor
  • radius

    A number representing the sphere radius in meters.

  • HSegments

    The number of the sphere horizontal segments (optional).

  • VSegments

    The number of the sphere vertical segments (optional).

HoloSphereGeometry
var sphere = new HoloBuild.HoloSphereGeometry( 0.1, 30, 30);
                       

HoloTetrahedronGeometry

The HoloTetrahedronGeometry is a 3D tetrahedron geometry made of several triangular segments. To construct a HoloTetrahedronGeometry you need to provided the tetrahedron radius.

Constructor
  • radius

    A number representing the tetrahedron radius.

HoloTetrahedronGeometry
var Tetrahedron = new HoloBuild.HoloTetrahedronGeometry(1);
                       

HoloTorusGeometry

The HoloTorusGeometry is a 3D tetrahedron geometry made of several triangular segments. To construct a HoloTorusGeometry you need to provided the tetrahedron radius, and tube radius.

Constructor
  • radius

    A number representing the torus radius.

  • tube

    A number representing the tube radius.

  • Segments

    The number of the torus segments (optional).

  • TSegments

    The number of the tubular segments (optional).

  • arc

    A radian representing the central arc of the torus (optional).

HoloTorusGeometry
var Torus = new HoloBuild.HoloTorusGeometry(0.1,0.3);
                       

Materials

A material defines how the surface of a geometry is. It describes the geometry appearance such as its color or its texture (i.e. skin).
There are several types of material that you can use such as the HoloMeshBasicMaterial, HoloMeshStandardMaterial, or the HoloMeshPhongMaterial. Each with its own properties and is applyies to a specific Hologram object. For example, a HoloMesh object can have a HoloMeshBasicMaterial, whereas a HoloLine object can have a HoloLineDashedMaterial.
Note: the HoloMeshBasicMaterial has the best performing material for a HoloMesh.

HoloMeshBasicMaterial

The HoloLens HoloMeshBasicMaterial defines how the surface of a geometry is. It describes the geometry appearance such as its color or its texture (i.e. skin). By default, the "Color" of the material is set to white, and you can change it to any color you want.

Properties
  • color

    Represents the color of the material.

  • map

    Represents the color map.

  • wireframe

    Render the mesh geometry as wireframe.

HoloMeshBasicMaterial
var material = new HoloBuild.HoloMeshBasicMaterial( { color: "green" } );
                       

HoloMeshStandardMaterial

The HoloLens HoloMeshStandardMaterial, similar to a HoloMeshBasicMaterial defines how the surface of a geometry is. It describes the geometry appearance such as its color or its texture (i.e. skin). By default, the "Color" of the material is set to white, and you can change it to any color you want. HoloMeshStandardMaterial give a more realistic looking material for Holograms than all the other material, but it is more expensive in terms of computaional resources.

Properties
  • color

    Represents the color of the material.

  • map

    Represents the color map.

  • wireframe

    Render the mesh geometry as wireframe.

HoloMeshStandardMaterial
var material = new HoloBuild.HoloMeshStandardMaterial( { color: "green" } );
                       

Holograms

Holograms are 3D digital objects that appear in the world around you as if they are real objects. Holograms respond to your interaction (gaze, gestures...) and to the physical world surfaces around you. For the most part, a HolographicMesh can be used to create different types of Holograms, and to group several Holograms together you use a HoloGroup. For specific types of geometries, such as line or a point, you have to use a different type of a mesh (HoloLineMesh or HoloPointMesh).

HoloMesh

A HolographicMesh is an object that takes a geometry and applies a material to it. So it is the combination of a geometry and material into one 3D object or a hologram that can then be added to a HoloSpace.

Constructor
  • geometry

    The geometry is the structure or the shape of a hologram.

  • material

    A material defines how the appearance of a geometry.

  • hotspot

    A boolean defining whether the HoloMesh is a hotspot or not. A hotspot is a mesh that accepts the user's interactions. Default is set to false. Setting the hotspot property to true has performance consequences, so only set it to true when necessary.

Properties
  • children

    Returns an array of the HoloMesh's children.

  • id

    A unique HoloMesh numeric identifier (readonly).

  • name

    Represent the HoloMesh's name.

  • parent

    Represent the HoloMesh's parent.

  • position

    Represent the HoloMesh's local position.

  • rotation

    Represent the HoloMesh's local rotation (in radians).

  • scale

    Represent the HoloMesh's local scale.

  • holoType

    Returns the type of this object. Example: HoloMesh.

  • userData

    An object that could be used by developers to store their own custom data about the HoloMesh.
    Note:It should not hold references to functions.
    Example: HoloMesh.userData = { propertyname: “property value” };
    And to use the property: HoloMesh.userData.propertyname;

  • visible

    if set to false the HoloMesh would not get rendered.

Methods
  • onTap
    = callbackfunction

    The callbackfunction that is called on a tap event: a combination of user gaze on the HoloMesh and hand presses and releases gesture. Other ways for the onTap function to be called is by pressing the button on a HoloLens Clicker or by speaking the voice command "Select".

  • onHold
    = callbackfunction(
    previousPos,
    currentPos)

    The callbackfunction that is called on a hold event: a combination of user gaze on the HoloMesh and the user hand press and moving gesture. The callbackfunction will be called with 2 positions vectors, the previous position and the current one.

  • onRelease
    = callbackfunction

    The callbackfunction that is called on a release event: a combination of user gaze on the HoloMesh and hand releases gesture. Other ways for the onRelease function to be called is if the user gestures get lost from the frame of view.

  • setAnimImage(image, {PARAMETERS})

    The setAnimImage sets an animated image on the HoloMesh, it takes as input an image file name. The image file contains a set of images (or frames) concatenaded next to each, which will be played in a loop (similar to an animated gif). An example animated gif: animated-block.gif Optionally the set image can take other parameters as an object that can contain the following:
    textureAnimWidth — Float. The frame width, by default the frame width is considered equale to the image height.

  • setImage(image,
    {PARAMETERS},
    callback)

    The setImage sets an image on the HoloMesh, it takes as input an image file name. Optionally the set image can take other parameters as an object that can contain the following:
    repeat — Boolean. If true the image will be repeated across the HoloMesh. Default is false.
    stretch — Boolean. If true the image will be stretched across the HoloMesh. Default is true.
    textureRepeatX — Number. How many times the texture is repeated across the X axis. Default is 1.
    textureRepeatY — Number. How many times the texture is repeated across the Y axis. Default is 1.

  • setTagAlong(boolean, distance)

    if set to true, the HoloMesh will never fully leaves the user's view. it will act as if it is attached to the user's head by rubber bands: When the user moves, the content will stay in his view. The distance paramerts is an optional parameter that specify how far is the HoloMesh from the user.

  • setTooltip(value,
    {PARAMETERS})

    The setTooltip shows a text on top of the HoloMesh that will be shown if the user hover at the HoloMesh for over a 1 second, it takes as input a text value. Optionally the setTooltip can take other parameters as an object that can contain the following:
    size — number. The tooltip size. Default is 0.015.
    color — color. The tooltip text color. Default is 0xFFFFFF.
    bgColor — color. The tooltip backgrounf color. Default is 0x048ad7.
    showLine — Boolean. If set to true the tooltip will have a dotted line drawn from the ToolTip down to the HoloMesh. Default is false.
    rounded — Boolean. If true, the tooltip will be rounded. Default is set to true.
    gap — number. The gap in meteres between the HoloMesh and the tooltip. Default is 0.035.
    yPos — number. The tooltip size. Default is 0.

  • animateMove (loc, duration, pause, callback,
    {parameters})

    animateMove method provides an animated move that interpolate between the current position and the new location. Location is a 3D vertix. It also takes as input an animation duration, an animation pause before start, and a callback function when the animation is done.
    Optional parameters include: increment a boolean parameter, if set to false it will move the mesh to the new pos, if set to true it will increment the mesh current position with the old position. Default is true
    Example 1:
    holomesh.position.set(0, 0, 0.5);
    holomesh.animateMove({ x: 0, y: 0, z: 0.1 }, 750, 250);

    In This example the holomesh will move to Z 0.6 (an increment on its current position), the animation will then pause for 250 milliseconds, and will last for 750 milliseconds.

    Example 2:
    holomesh.animateMove({ x: 0, y: 0, z: 0.1 }, 750, 250, '', {increment:false});

    In This example the holomesh will move to Z 0.1 (an incrememnt on its current position), the animation will then pause for 250 milliseconds, and will last for 750 milliseconds.

  • animateRotate(angles, duration, pause,
    callback, {parameters})

    animateRotate is similar to animateMove, and it provides an animated rotation.


  • animateFade(opacity, duration, pause,
    callback)

    animateFade is similar to animateMove, and it provides an animated opacity change.

  • show

    Calling the Show methods will enable the renderer to render the HoloMesh on its next update.

  • hide

    Calling the hide methods will hide the HoloMesh from the HoloSpace.

  • dispose

    Calling the dispose methods will deallocate the HoloMesh from memory.

  • add (object)

    Add a child object to the HoloMesh.

  • clone ()

    Returns a clone of the HoloMesh.

  • getObjectById (id)

    Searches through the HoloMesh's children and returns the object with a matching id.

  • getObjectByName
    (name)

    Searches through the HoloMesh's children and returns the first object with a matching name.

  • getObjectByProperty
    (propertyname)

    Searches through the HoloMesh's children and returns the first object with a matching propertyname.

  • getWorldPosition ()

    Returns a vector representing the position of the HoloMesh in the world space.

  • getWorldRotation ()

    Returns a vector representing the rotation of the HoloMesh in the world space.

  • getWorldScale ()

    Returns a vector representing the scaling factors applied to the HoloMesh in the world space.

  • getWorldDirection ()

    Returns a vector representing the direction of HoloMesh's positive z-axis in the world space.

  • remove (object)

    Removes a child object from the HoloMesh.

  • toJSON ()

    Convert the HoloMesh to JSON format.

  • showAdjust
    ({PARAMETERS})

    Once the showAjdust method is called, a helper box will be drawn on top of the attached HoloMesh to allow the user to manipulate the object. Manipulation of the mesh includes: moving, rotating, and scaling the mesh. You set which manipulation capabilities you want the user to be allowed to do by setting the parameters as follows:
    rotate — Boolean. True will enable the vertical and horizontal rotation of a mesh. Default is true.
    rotateVertical — Boolean. True will enable the vertical rotation of a mesh. Default is true.
    rotateHorizontal — Boolean. True will enable the horizontal rotation of the mesh. Default is true.
    scale — Boolean. True will enable the scaling of the mesh. Default is true.
    move — Boolean. True will enable the moving of the mesh. Default is true.
    done — Boolean. True will enable a done button to be shown with the adjust controls, false will not show the done button. Default is true.

  • animationClip
    (clipname)

    animationClip is a special method that loads the animation clips available for the mesh using the clip name. This method returns an instance of the HoloAnimation class that includes the following methods to manage an animation clip:
    run() — a method to start running the animation.
    pause() — a method to pause the animation.
    stop() — a method to stop the playing animation.
    reset() — a method to reset the playing animation.
    isRunning() — a method that returns true if the action is running.
    isEnabled() — a method that returns true for the current clip.
    setEffectiveTimeScale(number) — a method to set the timescale of the clip: 0 will pause the animation, a postive number will play the animation and anegative will paly it backward.
    fadeIn(time) — a method to fade in the playing animation by a time in seconds.
    fadeOut(time) — a method to fade in the playing animation by a time in seconds.
    crossFadeFrom(clip, time, warp) — a method to fade in a clip and fade out another clip within a time (wrap is a boolean if set to true will wrap the animation from one to the other).
    crossFadeTo(clip, time, warp) — a method to fade out a clip and fade out to another clip within a time (wrap is a boolean if set to true will wrap the animation from one to the other).
    startAt(time) — a method to start the animation at a given numeric time in seconds.

  • addIndicator
    ({PARAMETERS});

    Sometims a HoloMesh is outside of the user's field of view, or occlude by real world objects, and it is important to make it easier for the user to find that HoloMesh. You can use the addIndicator method which will shows in the form of a directional arror, or your own holomesh object, in order to alert the user to that important content and provide guidance related to the user's position.
    The directional indicator will appear when the user is looking away from the HoloMesh. The arrow like direction indicator will point the user toward the HoloMesh, if it is away from the user's view and away to a specfic distance you can specify.
    This function takes an array of Parameters:
    distance — The indicator will continue to show until the minimum distance in meter to the HoloMesh is reached. Default
    color — By default the indicator is an arrow, you can change the default cursor color by specifing the color parameter. Default: 'red'
    object — This own HoloMesh object that you can use as a direction indicatory (optional).

  • removeIndicator();

    Removes the direction indicator that was already set on that HoloMesh (see addIndicator for more information).

HoloMesh

var geometry = new HoloBuild.HoloBoxGeometry( 0.1, 0.1, 0.1 );
var material = new HoloBuild.HoloMeshBasicMaterial( { color: 'red' } );
var holomesh= new HoloBuild.HoloMesh( geometry, material );
                       

You can use the onTap property if you want to add a function to when the user tap the holomesh. For example, if we want to rotate the holomesh on the x axis when the user tap on it we can do the following:
var holomesh= new HoloBuild.HoloMesh( geometry, material , true);
holomesh.onTap = function () {
holomesh.rotation.x +=0.1;
}
    
You can use the onHold property if you want to add a function to when the user gaze on the holomesh and moving his hand while holding the press gesture. For example, if we want to change the holomesh position on the x axis according to the users hand, we can do the following:
holomesh.onHold = function (previousPos, CurrentPos) {
holomesh.position.x -= (previousPos.x - CurrentPos.x);
}
    

You can use the setImage method to set an image to the HoloMesh.
holomesh.setImage('imagename.png')
If you want to use the setImage parameters, you do the following:
holomesh.setImage('imagename.png',{repeat:true})

setToolTip example
Let us show a tooltip showing a line on top of a HoloMesh:
HoloMesh ToolTip
A ToolTip saying hello over a yellow box holomesh. Notice the cursor, the tooltip only shows when the user is looking at the holomesh.

var holomesh= new HoloBuild.HoloMesh( geometry, material , true);
holomesh.setTooltip('Hello', {showLine:true});

ShowAdjust example
Let us show a HoloMesh Adjust box when a user tap on a holomesh:
HoloMesh Adjust Box
ShowAdjust Box on a yellow sphere holomesh. Notice the holocursor showing a rotation icon, and the done button to commit the adjustment when the user click on the done button.

var holomesh= new HoloBuild.HoloMesh( geometry, material , true);
holomesh.onTap = function (){
holomesh.showAdjust();    
};

HoloGroup

A HoloGroup is a component that holds a group of HoloMeshes.

Properties
  • children

    Returns an array of the HoloGroup's children.

  • id

    A unique HoloGroup numeric identifier (readonly).

  • name

    Represent the HoloGroup's name.

  • parent

    Represent the HoloGroup's parent.

  • position

    Represent the HoloGroup's local position.

  • rotation

    Represent the HoloGroup's local rotation (in radians).

  • scale

    Represent the HoloGroup's local scale.

  • holoType

    Returns the type of this object. Example: Group.

  • userData

    An object that could be used by developers to store their own custom data about the HoloGroup.
    Note:It should not hold references to functions.
    Example: holoGroup.userData = { propertyname: “property value” };
    And to use the property: holoGroup.userData.propertyname;

  • visible

    if set to false the HoloGroup would not get rendered.

  • onTap
    = callbackfunction

    The callbackfunction that is called on a tap event: a combination of user gaze on any child mesh of the HoloGroupand hand presses and releases gesture. Other ways for the onTap function to be called is by pressing the button on a HoloLens Clicker or by speaking the voice command "Select". the tap even will be called for the HoloGroup and the HoloMesh that was tapped (only one level up and down).

Methods
  • add (object)

    Add a child object to the HoloGroup.

  • clone ()

    Returns a clone of the HoloGroup.

  • getObjectById (id)

    Searches through the HoloGroup's children and returns the object with a matching id.

  • getObjectByName
    (name)

    Searches through the HoloGroup's children and returns the first object with a matching name.

  • getObjectByProperty (propertyname)

    Searches through the HoloGroup's children and returns the first object with a matching propertyname.

  • getWorldPosition ()

    Returns a vector representing the position of the HoloGroup in the world space.

  • getWorldRotation ()

    Returns a vector representing the rotation of the HoloGroup in the world space.

  • getWorldScale ()

    Returns a vector representing the scaling factors applied to the HoloGroup in the world space.

  • getWorldDirection ()

    Returns a vector representing the direction of HoloGroup's positive z-axis in the world space.

  • setTagAlong(boolean, distance)

    if set to true, the HoloGroup will never fully leaves the user's view. it will act as if it is attached to the user's head by rubber bands: When the user moves, the content will stay in his view. The distance paramerts is an optional parameter that specify how far the HoloGroup is from the user.

  • remove (object)

    Removes a child object from the HoloGroup.

  • toJSON ()

    Convert the HoloGroup to JSON format.

  • show ()

    Calling the Show methods will enable the renderer to render the HoloGroup on its next update.

  • hide ()

    Calling the hide methods will hide the HoloGroup from the HoloSpace.

  • showAdjust
    ({PARAMETERS})

    Once the showAjdust method is called, a helper box will be drawn on top of the attached HoloGroup to allow the user to manipulate the group. Manipulation of the group includes moving, rotating, and scaling the group. You set which manipulation capabilities you want the user to be allowed to do by setting the parameters as follows:
    rotate — Boolean. True will enable the vertical and horizontal rotation of a group. Default is true.
    rotateVertical — Boolean. True will enable the vertical rotation of a group. Default is true.
    rotateHorizontal — Boolean. True will enable the horizontal rotation of the group. Default is true.
    scale — Boolean. True will enable the scaling of the group. Default is true.
    move — Boolean. True will enable the moving of the group. Default is true.

  • hideAdjust ()

    Once the hideAjdust method is called, the helper box shown in the showAdjust will be forces to be hidden. The user adjust changes will be commited.

  • dispose ()

    Calling the dispose methods will deallocate the HoloGroup from memory.

HoloGroup
var group = new HoloBuild.HoloGroup();
group.add(holomesh);
                       

HoloPoints

The HoloPoints is a class that represents 3d points, it takes as input a geometry of vertices and apply a points material to them. Use this class if you want to add points into your 3d space.

Constructor
  • geometry

    a geometry containing the vertices.
    To define a geometry of vertices use the class HoloGeometry() to define the gometry and HoloVector3() to define the vertices.
    var pointsGeometry = new HoloBuild.HoloGeometry();
    var point1 = new HoloBuild.HoloVector3(0.1, 0.1, 0.1);
    pointsGeometry.vertices.push(point1);

  • pointsmaterial

    A points material that could applied to points.
    To define a points material use the class HoloPointsMaterial(parameters)
    HoloPointsMaterial parameters includes:
    color — Color. the material color. Default is 0xffffff or white.
    size — Number. the default point size. Default is 1.

HoloPoints
var pointsGeometry = new HoloBuild.HoloGeometry();
var point1 = new HoloBuild.HoloVector3(0.1, 0.1, 0.1);
var point2 = new HoloBuild.HoloVector3(0.2, 0.2, 0.2);

pointsGeometry.vertices.push(point2);
pointsGeometry.vertices.push(point1);

var pointsMaterial = new HoloBuild.HoloPointsMaterial({color : 'red', size: 0.01});
var points = new HoloBuild.HoloPoints(pointsGeometry, pointsMaterial);
holoscene.add(points)
                       

HoloLine

The HoloLine is a class that represents a line, it takes as input a geometry of vertices and apply a line material to them. Use this class if you want to add a lines into your 3d space.

Constructor
  • geometry

    a geometry containing the vertices.
    To define a geometry of vertices use the class HoloGeometry() to define the gometry and HoloVector3() to define the vertices.
    var pointsGeometry = new HoloBuild.HoloGeometry();
    var point1 = new HoloBuild.HoloVector3(0.1, 0, 0);
    var point2 = new HoloBuild.HoloVector3(0, 0.2, 0);
    pointsGeometry.vertices.push(point1);
    pointsGeometry.vertices.push(point2);

  • linematerial

    A line material that could applied to points.
    To define a line material you can use one of the following two classes HoloLineBasicMaterial(parameters) or HoloLineDashedMaterial(parameters)
    The first draw a simple line, the second draws a dashed one
    the HoloLineBasicMaterial parameters includes:
    color — Color. the material color. Default is 0xffffff or white.
    the HoloLineDashedMaterial parameters includes:
    color — Color. the material color. Default is 0xffffff or white.
    dashSize — Number. the dash size. Default is 3.
    gapSize — Number. the gap size. Default is 1.

HoloLine
var pointsGeometry = new HoloBuild.HoloGeometry();
var point1 = new HoloBuild.HoloVector3(0.1, 0, 0);
var point2 = new HoloBuild.HoloVector3(0, 0.2, 0);
var point3 = new HoloBuild.HoloVector3(0.3, 0.0, 0.0);

pointsGeometry.vertices.push(point1);
pointsGeometry.vertices.push(point2);
pointsGeometry.vertices.push(point3);

var lineMaterial = new HoloBuild.HoloLineBasicMaterial({color : 'red'});
var lines = new HoloBuild.HoloLine(pointsGeometry, lineMaterial);
holoscene.add(lines);
                       

HoloLoaders

The HoloLoaders is a class loads objects from file and return a mesh, a geometry, or a group.

Methods
  • loadModel
    (type, filename,
    callback(model),
    {parameters})

    Load a 3d model from a file.
    type — String. The model type that you want to load, values include: HoloBuild.loader.OBJ(), HoloBuild.loader.STL(), orHoloBuild.loader.JSON()

    filename — Color. the material color. Default is 0xffffff or white.
    callback(model) — Function. the function that will be called back when the model is loaded, with the actual model.
    parameters — List of optional parameters to apply. This include: material to apply a specific material to your model, mtlPath to apply a material to the model loaded from a file, hotspot() a boolean that if set to true will enable the interaction with the model, or group a boolean to whether to return the model as a group or merge it as one mesh. Note that mtlPath requires a group so you must set the parameters group to true for the material to be applied.

  • loadGeometry
    (type, filename,
    callback(geometry)

    Load a geometry from a file.
    type — String. The geometry type that you want to load, values include: HoloBuild.loader.OBJ(), HoloBuild.loader.STL(), orHoloBuild.loader.JSON()
    filename — Color. the material color. Default is 0xffffff or white.
    callback(geometry) — Function. the function that will be called back when the geometry is loaded, with the actual geometry.
    parameters — List of optional parameters to apply. This include: array boolean parameter if set to true will return an array of geometries instead of one geometry.

HoloLoaders
var loaders = new HoloBuild.HoloLoaders();
loaders.loadModel(HoloBuild.loader.JSON, 'flamingo.js', function (model) {
    model.scale.set(0.003, 0.003, 0.003);
    holoscene.add(model);
}, {
        hotspot: true
});
                       

Lights

A light provides a digital illumicatio of the Holograms in your HoloSpace. There are several types of lights that you can add to you HoloSpace. The system by default adds an ambient light, otherwise all Holograms will show up as black. An ambinet light will light all the Holograms in your scene equally as it doesn't have a directon. If you want a light that emits in a specific direction, then you need to use a HoloDirectionalLight. For a light that emits from a single point, such as from a light bulb, use a HoloPointLight. The following section will go over the different types of lights available in more details:

HoloDirectionalLight

The HoloDirectionalLight emits light in a specific direction similar to a light from the sun.

Constructor
  • color

    Represents the color of the light, default is 0xffffff or white.

  • intensity

    A numeric value representing the intensity of the light, default is 1.

HoloDirectionallight
var material = new HoloBuild.HoloDirectionalight( 0xf1f1f1, 0.7 );
                       

HoloPointLight

The HoloPointLight emits light from a specific point, similar to a light from a bulb.

Constructor
  • color

    Represents the color of the light, default is 0xffffff or white.

  • intensity

    A numeric value representing the intensity of the light, default is 1.

  • distance

    The distance the light can travel, default is 1.

HoloPointlight
var material = new HoloBuild.HoloPointlight( 0xf1f1f1, 0.7, 0.5 );
                       

HoloSpotLight

The HoloSpotLight emits light from a specific point as a cone shape.

Constructor
  • color

    Represents the color of the light, default is 0xffffff or white.

  • intensity

    A numeric value representing the intensity of the light, default is 1.

  • distance

    The distance the light can travel, default is 1.

  • angle

    The angle of the cone that light will form.

HoloSpotlight
var material = new HoloBuild.HoloSpotlight( 0xf1f1f1, 0.7, 0.5, 0.4 );
                       

UI Components

The following section go over the holobuild library User Interface components. These include components ranging from navigation Holograms, such as a HoloButton or a HoloToolbar, to input controls such as a HoloStepper.

HoloLabel

The HoloLabel represents a label component used to display text in a HoloSpace. The HoloLabel is also useful when you want to show a text with a language that is not supported by the HoloLens, such as Chinese, Arabic, or Russian letters. The HoloLabel extends the HoloGroup class, it inherits all the HoloGroup's properties and methods.

Constructor
  • name


    The label name.

  • text

    The text to be displayed.
    text — String. One line text.
    OR
    text — Array of Strings. Multi-line text.

  • {PARAMETERS} optional

    An object that can contain the following parameters:
    size — Float. Size of the text (text height). Default is 40.
    color — Color. The text color. Default is set to 0x101010.
    width — Float. The label width. Default is set to 0.08.
    height — Float. The label height. Default is set to 0.
    padding — Float. The text padding to its background. Default is 0.02.
    bgColor — Color. The text background color. Default is transparent.
    rounded — Boolean. If true, the HoloLabel will be rounded. Default is set to false.
    hotspot — Boolean. If true, the cursor will intersect with the HoloLabel. Default is set to true.
    align — String. ('left', 'right', 'center'). the label text will be aligned accordingly. Default is set to center. The width parameter needs to be filled for the left or right alignemnt to work.

Methods
  • setText(text,
    {PARAMETERS})

    Set or Change the HoloLabel text to text
    text — String. One line text.
    OR
    text — Array of Strings. Multi-line text.
    PARAMETERS is an optional object that can contain the following parameters:
    size — Float. Size of the text (text height). Default is 40.
    color — Color. The text color. Default is set to 0x101010.
    align — String. ('left', 'right', 'center'). the label text will be aligned accordingly. Default is set to center. The width parameter needs to be filled for the left or right alignemnt to work.

  • getText()

    Return the HoloLabel text as a string.

  • getHeight()

    Return the HoloLabel current height.

HoloLabel
var labelTest = new HoloBuild.HoloLabel('lblValue', 'hello', { size: 0.02, color: 0x101010, bgColor: 0xFFFF00, padding: 0.03 } );
                       
To change the text of the label above:
labelTest.setText('world');
To change the text to multiple lines of text:
labelTest.setText(['Hello', 'World']);
'Hello' will be one line and 'World' will be on the next line.

HoloButton

The HoloButton represents an image based button component in a HoloSpace. Since the HoloButton extends the HoloMesh class, it inherits all the HoloMesh's properties and methods.

Constructor
  • name

    The HoloButton Name.

  • width

    The HoloButton width.

  • height

    The HoloButton height.

  • depth

    The HoloButton depth, 0 for a plane geometry and > 0 for a box geometry.

  • {PARAMETERS} optional

    An object that can contain the following parameters:
    bgColor — String Hex Color. Background button color. Default is 0x3c3c3c.
    borderColor — String Hex Color. Border color that will be shown when the button is clicked.
    borderThickness — Float. Border thickness in pixels that will be shown when the button is clicked. Default is 3 pixles.
    hoverState — Boolean. Whether a hover effect is available or not. Default is true.
    hoverBorderColor — String Hex Color. Hover border color that will be shown when the button is hovered.
    hoverBorderThickness — Float. Hover border thickness in pixels that will be shown when the button is hovered. Default is 3 pixles.
    clickState — Boolean. Whether a click effect is available or not. Default is true.
    clickBorderColor — String Hex Color. Click border color that will be shown when the button is clicked.
    clickBorderThickness — Float. Click border thickness in pixels that will be shown when the button is clicked. Default is 4 pixles.
    image — String. Image filename that will show as the button background.
    text The button text. Default is null.
    fontSize The button text font size. Default is 40
    fontColor The button text font color. Default is 0xFFFFFF.
    fontWeight The button text font weight. Default is 'normal'.
    textAnchor: The button text position: .CENTER, .TOPLEFT, .TOPCENTER, .TOPRIGHT, .BOTTOMLEFT, .BOTTOMCENTER, .BOTTOMRIGHT . Default is .CENTER.
    soundMute — Boolean. if set to true will disable the spatial sound taha will be played when a user tap on the button.
    sound — String. the filename of the sound file that will be played when a user tap on the button.

    To create your button image, use the Selawik Regular font for consistency and the following PSD file for buttons icons icons.psd For the icon set used by the Hololensuse the following fonts: holomdl2.ttf and HoloSymMDL2.ttf

Methods
  • setEnabled();

    This method will either disable the button or enable it.

  • setText(text,
    {PARAMETERS});

    Set or Change the HoloButton text text value.
    PARAMETERS is an optional object that can contain the following parameters:
    fontSize The button text font size. Default is 40
    fontColor The button text font color. Default is 0xFFFFFF.
    fontWeight The button text font weight. Default is 'normal'.
    textAnchor: The button text position: .CENTER, .TOPLEFT, .TOPCENTER, .TOPRIGHT, .BOTTOMLEFT, .BOTTOMCENTER, .BOTTOMRIGHT . Default is .CENTER.

  • getText()

    Return the HoloButton text. text — String. Button text.

HoloButton
var btnPrevMesh = new HoloBuild.HoloButton("CtrlPrev", 0.1, 0.1, 0,{ image:'prev.png'});
                              

HoloSwitch

HoloSwitch is a switch like component that is very similar to the button but that keeps its on state or image once the user tap on it and returns to its off state once the user tap on it again. Since the HoloSwitch extends the HoloMesh class, it inherits all the HoloMesh's properties and methods.

Constructor
  • name

    The HoloSwitch Name.

  • width

    The HoloSwitch width.

  • height

    The HoloSwitch height.

  • depth

    The HoloSwitch depth, 0 for a plane geometry and > 0 for a box geometry.

  • {PARAMETERS} optional

    An object that can contain the following parameters:
    bgColor — String Hex Color. Background button color. Default is 0x3c3c3c.
    borderColor — String Hex Color. Border color that will be shown when the button is clicked.
    borderThickness — Float. Border thickness in pixels that will be shown when the button is clicked. Default is 3 pixles.
    hoverState — Boolean. Whether a hover effect is available or not. Default is true.
    hoverBorderColor — String Hex Color. Hover border color that will be shown when the button is hovered.
    hoverBorderThickness — Float. Hover border thickness in pixels that will be shown when the button is hovered. Default is 3 pixles.
    clickState — Boolean. Whether a click effect is available or not. Default is true.
    clickBorderColor — String Hex Color. Click border color that will be shown when the button is clicked.
    clickBorderThickness — Float. Click border thickness in pixels that will be shown when the button is clicked. Default is 4 pixles.
    image — String. Image filename that will show as the button background.
    text The button text. Default is null.
    fontSize The button text font size. Default is 40
    fontColor The button text font color. Default is 0xFFFFFF.
    fontWeight The button text font weight. Default is 'normal'.
    textAnchor: The button text position: .CENTER, .TOPLEFT, .TOPCENTER, .TOPRIGHT, .BOTTOMLEFT, .BOTTOMCENTER, .BOTTOMRIGHT . Default is .CENTER.

    To create your button image, use the Selawik Regular font for consistency and the following PSD file for buttons icons icons.psd For the icon set used by the Hololensuse the following fonts: holomdl2.ttf and HoloSymMDL2.ttf

Methods
  • toggle();

    This method will toggle the switch status: it will visually turn the switch on if it was off or the other way around.

  • setEnabled();

    This method will either disable the button or enable it.

HoloSwitch
var btnPrevMesh = new HoloBuild.HoloSwitch("CtrlPrev", 0.1, 0.1, 0);
                       
Two switches in one group, one switch can be selected at a time:

var groupMenu = new HoloBuild.HoloGroup();
var btnWidth = 0.105;
var btnHeight = 0.105;
var btnOne = new HoloBuild.HoloSwitch("ControlOne", btnWidth, btnHeight, 0,{ clickBorderColor: 0xFF0000, groupName: "first" });
var btnTwo = new HoloBuild.HoloSwitch("ControlTwo", btnWidth, btnHeight, 0,'icon-Two.png', '', { clickBorderColor: 0x00FF00, groupName: "first" });
groupMenu.add(btnOne);
groupMenu.add(btnTwo);
                                          

HoloStepper

A HoloStepper is a component that holds two buttons ( + and - ) that increment or decrement a numeric label value.

Constructor
  • name

    The stepper component name.

  • value

    The stepper value.

  • width

    The stepper control width.

  • {PARAMETERS} optional

    An object that can contain the following parameters:
    size — Float. Size of the text (text height). Default is 0.02 meters.
    color — The text color. Default is set to 0x101010.
    bgcolor — The text background color. Default is 0xFFFFFF.
    padding — Float. The text padding to its background. Default is 0.02.
    min — Float. The lowest possible numeric value for the HoloStepper. Default is 0.
    max — Float. The highest possible numeric value for the HoloStepper. Default is 100.
    increment — Float. The increment, or step, value for the HoloStepper. Default is 1.

HoloStepper
var stepperTest = new HoloBuild.HoloStepper('stepper1', '0', 0.08, { max: 100, increment: 5 });
                       

HoloToolbar

A HoloToolbar is a component that holds buttons and that is usually used as an application menu.

Constructor
  • btnWidth

    The default button width.

  • btnHeight

    The default button height.

  • {PARAMETERS} optional

    vertical An optional Boolean value that if enabled will draw the HoloToolbar vertically. reverse An optional Boolean value that if enabled will draw the HoloToolbar in the reverse direction (from right to left).

Methods
  • addButton (name,
    {PARAMETERS})

    addButton will add a button to the toolbar with a specific name and a set of parameters: image — String. This is the image filename that will show on the button.

  • addSwitch (name,
    {PARAMETERS})

    addSwitch will add a switch to the toolbar with a specific name and a set of parameters: image — String. This is the image filename that will show on the switch.

  • addSubToolbar
    (toolbarSub, btn,
    toggleMode);

    Add a child HoloToolBar to the main toolbar an link it to a specfic button or switch. If a use tap on the linked button or switch, the subtoolbar will be automatically toggled. toggleMode is an enumerator that specificy the position of the sub toolbar: toggleMode elements include the following : toggleMode.LEFT, toggleMode.RIGHT, toggleMode.TOP, toggleMode.BOTTOM.

  • reset();

    Resets the toolbar by turning off any switches and closing any subtoolbar.

  • reverseOrder();

    Reverse the direction of the toolbar from LTR to RTL or the otherway around.

HoloToolbar
var menuCtrl = new HoloBuild.HoloToolbar(0.105, 0.105);

menuCtrl.addButton("CtrlAdjust", {image: "adjust.png"});

menuCtrl.addButton("CtrlMove", {image: "move.png"});

menuCtrl.getObjectByName('CtrlMove').onTap = function () {
menuCtrl.position.x +=0.1;
}

//Sub toolbar
var toolbarSub = new HoloBuild.HoloToolbar(0.125, 0.125);
toolbarSub.addButton("ControlAbout", {
    image: "about-off.png"
});
var btnAdjust = toolbar.getObjectByName('CtrlAdjust');
menuCtrl.addSubToolbar(toolbarSub, btnAdjust, HoloBuild.toggleMode.RIGHT);

                       

HoloPanel

A HoloPanel is a panel component that can hold other components such as HoloLabel, a HoloButton, or a HoloSwitch. Since the HoloPanel extends the HoloMesh class, it inherits all the HoloMesh's properties and methods.

Constructor
  • name

    The HoloPanel name.

  • width

    The HoloPanel width.

  • height

    The HoloPanel height.

  • {PARAMETERS}

    bgColor The HoloPanel background color. Default is 0x3c3c3c.
    close A Boolean value that if set to true will show an X like button on top of the HoloPanel that will close the panel once the user tap on it.

Methods
  • addChild(object, pos);

    Add a child object to the panel. pos is the position of the child in respect to the panel.

  • onClose
    = callbackfunction

    The callbackfunction that is called when the panel close button tap event..

  • setHeight(height);

    Set or Change the HoloPanel height to height value.

HoloPanel
var panelTest = new HoloBuild.HoloPanel('panel1', 0.5, 0.3, 0x010123, true);
var labelTest = new HoloBuild.HoloLabel('lblValue', 'hello', { size: 0.02, color: 0x101010, bgColor: 0xFFFF00, padding: 0.03 } );

panelTest.addChild(labelTest, { x: 0.07, y: 0.05 });

var panelImage = new HoloBuild.HoloPanel('panelImage', 0.2, 0.2, 0xFFFFFF);

panelImage.setImage('SampleImage.png');

panelTest.addChild(panelImage, { x: -0.11, y: 0 });
                       
To have a function called when the panel is closed:
panelName.onClose = function () {
// your function logic here
}
                       

HoloDialog

A HoloDialog is a dialog component that can be used as either message notification to the user or when needing a confirmation from the user. Since the HoloPanel extends the HoloGroup class, it inherits all the HoloGroup's properties and methods.

Constructor
  • name

    The HoloDialog name.

  • title

    The HoloDialog Title.

  • text

    The HoloDialog text.

  • PARAMETERS

    Optionally the HoloDialog can take other parameters as an object that can contain the following:
    mode — enumerator. The mode of the dialog: (dialogMode.DEFAULT, dialogMode.CONFIRM, or dialogMode.INFO). dialogMode.DEFAULT for a notification like dialog with a close button; dialogMode.CONFIRM for a confirmation like dialog with a YES and NO buttons; HB.Enum.dialogMode.INFO for an information only dialog without any buttons. Default is dialogMode.DEFAULT.
    canvas — boolean. whether the HoloDialog title label is of type canvas or not. Default is false.
    bgColor — color. The HoloDialog background color. Default is 0x070707.
    titleColor — color. The HoloDialog title color. Default is 0xFFFFFF.
    titleBgColor — color. The HoloDialog title background color. Default is 0x1C1C1C.
    bodyColor — color. The HoloDialog body color. Default is 0xFFFFFF.
    bodyBgColor — color. The HoloDialog body backgrounf color. Default is 0x070707.
    titleAlign — String. ('left', 'right', 'center'). the HoloDialog title alignment. Default is left.
    bodyAlign — String. ('left', 'right', 'center'). The HoloDialog body alignment. Default is left.

  • callbackfunction optional

    The callbackfunction is the call back function that will be called when the user perform an action on the HoloDialog. If the dialog mode is dialgMode.CONFIRM, the callback function will be called with one boolean argument. The boolean value will be true if the YES button is tapped, or false otherwsie.

Methods
  • setText(text);

    Set or Change the HoloDialog text text value.

HoloDialog
Message dialog example:

var dialogAlert = new HoloBuild.HoloDialog('dialog1', 'Alert', 'this is an alert message!', {mode: HoloBuild.dialogMode.DEFAULT },
      function (action) {
            console.log('dialog callback');
      }
);
                       
Confirmation dialog example:

var dialogGroup = new HoloBuild.HoloDialog('dialogConfirm', 'Confirm', 'Are you sure you want to do this?', {mode: HoloBuild.dialogMode.CONFIRM });
                       

HoloCheckBox

A HoloCheckBox is a checkbox component that allows the user to choose between two options. Since the HoloCheckBox extends the HoloButton class, it inherits most of the HoloButton's properties and methods.

Constructor
  • name

    The HoloCheckBox Name.

  • size

    A number denoting the HoloCheckBox width and height, it is one number since the checkbox has a square form.

  • depth

    The HoloCheckBox depth, 0 for a plane geometry and > 0 for a box geometry.

  • {PARAMETERS} optional

    An object that can contain the following parameters:
    bgColor — String Hex Color. Background button color. Default is 0x3c3c3c.
    borderColor — String Hex Color. Border color that will be shown when the button is clicked.
    borderThickness — Float. Border thickness in pixels that will be shown when the button is clicked. Default is 3 pixles.
    hoverState — Boolean. Whether a hover effect is available or not. Default is true.
    hoverBorderColor — String Hex Color. Hover border color that will be shown when the button is hovered.
    hoverBorderThickness — Float. Hover border thickness in pixels that will be shown when the button is hovered. Default is 3 pixles.
    clickState — Boolean. Whether a click effect is available or not. Default is true.
    clickBorderColor — String Hex Color. Click border color that will be shown when the button is clicked.
    clickBorderThickness — Float. Click border thickness in pixels that will be shown when the button is clicked. Default is 4 pixles.
    image — String. Image filename that will show as the button background.
    fontSize The button text font size. Default is 40
    fontColor The button text font color. Default is 0xFFFFFF.
    fontWeight The button text font weight. Default is 'normal'.
    textAnchor: The button text position: .CENTER, .TOPLEFT, .TOPCENTER, .TOPRIGHT, .BOTTOMLEFT, .BOTTOMCENTER, .BOTTOMRIGHT . Default is .CENTER.
    soundMute — Boolean. if set to true will disable the spatial sound taha will be played when a user tap on the button.
    sound — String. the filename of the sound file that will be played when a user tap on the button.
    checked — Boolean. if set to true will have an X on the checkbox and its sstatus to checked.

Property
  • checked

    This property will return a boolean representing the checkbox staus, true for checked and false for not checked.

Methods
  • setEnabled();

    This method will either disable the button or enable it.

HoloCheckBox
var checkbox = new HoloBuild.HoloCheckBox("CtrlCheckBox", 0.05,{ bgColor:0x3c3c3c , fontColor: 0xFFFFFF, borderColor: 0xFFFFFF, checked: false});
checkbox.onTap = function () {
    // checkbox has been tapped
}
holoscene.add(checkbox);
                              

Speech

This section details the various classes that deal with speech.

HoloSpeechRecognition

HoloSpeechRecognition is the class that deals with continous speech recognition that will help you enabling your application to recognize voice commands. By default your application have the "select" command enabled: users can tap on a mesh by simply saying "select".

Methods
  • addVoiceCommand
    (command, callback);

    This method will add a voice command that the speech recognition system will monitor for. Once the command is recognized with a high confidence, the callback function will be called.
    command String- The voice command string that you want the system to recognize
    callback Function- The function that will be called once the system recoginize the command

  • updateVoiceCommand
    (command, callback);

    This method will update the callback function of an already defined voice command.
    command String- The voice command string that you want the recognizer to update
    callback Function- The new function that will be called once the system recoginize the command

  • setConfidence (level);

    This method will update how confident the system should before calling the callback function.
    level Float- The minimum level of confidence to recognize a command. Default is 0.5

HoloSpeechRecognition
HoloBuild.HoloSpeechRecognition.addVoiceCommand('start', function () {
    var geometry = new HoloBuild.HoloBoxGeometry(0.05, 0.05, 0.05);
    var material = new HoloBuild.HoloMeshBasicMaterial({ color: 'red' });
    var holomesh = new HoloBuild.HoloMesh(geometry, material, true);
    holomesh.position.set(0, 0, -0.5);
    holoscene.add(holomesh);
});
Once the user says 'start' a red holomesh will be added to the scene.

Sound

The section details the various classes that deal with sound.

HoloSpatialSound

HoloSpatialSound is the class that deals with simulating placing a sound in 3 dimensional space. You simply load a sound file, attach it to the object that you want the sound to come from, and run the HoloSpatialSound play method to play the sound. The spatial sound takes into consideration the direction and distance of the object to gives the impression that the sound is coming from that object.

Constructor
  • filename

    String - The sound file name that you want to load.

Methods
  • play()

    play the sound file.

  • pause()

    Pause the sound play.

  • setLoop ( isloop )

    Set the playing to be looped or not
    isloop - Boolean : if set to true the sound file will keep on playing.

  • setPlaybackRate
    ( rate )

    Set the play back speed. Default is 1
    rate - Number : a number representing the speed of the sound.

  • setVolume
    ( volume )

    Set the volume of the sound
    volume - Number : a number that reflects the playing sound volume.

  • setPlaybackRate
    ( rate )

    Set the play back speed. Default is 1
    rate - Number : a number representing the speed of the sound.

  • stop()

    Stop the playing sound.

HoloSpatialSound
var spatialsound = HoloBuild.HoloSpatialSound('Ring.wav');
var geometry = new HoloBuild.HoloBoxGeometry(0.05, 0.05, 0.05);
var material = new HoloBuild.HoloMeshBasicMaterial({ color: 'red' });
var holomesh = new HoloBuild.HoloMesh(geometry, material, true);
holomesh.position.set(0, 0, -0.5);
holoscene.add(holomesh);
holomesh.add(spatialsound);
    
holomesh.onTap = function () {
    spatialsound.play();
};

Spatial World

This section details the various classes that deal with the real world around you. This includes, the mapping of the space arround you, anchoring holograms to your real space, and more.

HoloSpatialMap

The HoloSpatialMao class provides with a detailed map of the real world surfaces around the hololens, the resulted surfaces are then returned to the developer to use in their application. First you must start a spatial map scan to collect the surfaces around the hololens, once done, the system will process these surfaces and return an array of planes for you to use.

Methods
  • start()

    Start spatial mapping the space around you, a visual texture will be displayed to help guide the user with the spatial mapping.

  • stop
    (callback)

    Stop an already started spatial map scan. callback - Function(geometries) : an optional call back function will be called with the resulted geometries for the developer processing. Note that the resulted geometries are the raw data and it is not recommended to render them onto the scene as is.

  • getPlanes()

    a functions that returns an array of planes resulted from a spatial mapp. If the user has not performed a spatial map, the plan array will be empty.

HoloSpatialMap
HoloBuild.HoloSpatialMap.start();
var material = new HoloBuild.HoloMeshBasicMaterial({ color: 'red' });
var holomesh = new HoloBuild.HoloMesh(geometry, material, true);
holoscene.add(holomesh);

holomesh.onTap = function () {
    HoloBuild.HoloSpatialMap.stop();    
};

HoloSpatialAnchor

The system automatically create a stage frame of reference when the user first start the application to provide you with one single coordniate system to render your holograms. This will make your hologram look stable and not drift around. However, if you need to maintain the position of a hologram through multiple appliction sessions, or you the user might move beyound 5 meters away from the hologram, it would be better to use a spatial anchor to keep the hologram position stable.
HoloSpatialAnchor is the manager that handles spatial positions relative to real world positions (or anchors) and maintain them even when the application is restarted and over long distances.
You simply setAnchor on a mesh to save its position relative to the real world on the Hololens and give that anchor a name, then you can loadAnchor saved using its name and set it on that holomesh.

Methods
  • loadAnchor
    (object, anchorname,
    callback(success) )

    load a saved anchor position, with the name anchorname, and place an object on that position.
    holomesh - Object : the hologram whose anchor is to be saved. anchorname - String : the anchor's name. callback(success) - Function : a callback function that will be called when load anchor completes it task, success is a boolean that will be set to true if the anchor is loaded successfully.

  • setAnchor
    (object, anchorname,
    callback(success) )

    Save an anchor, with the name anchorname, and get the anchor position and rotation from the object.
    holomesh - Number : a number representing the speed of the sound. anchorname - String : the anchor's name. callback(success) - Function : a callback function that will be called when set anchor completes its task, success is a boolean that will be set to true if the anchor is set successfully.

  • deleteAnchor
    (anchorname, callback(success) )

    delete a saved anchor, with the name anchorname.
    anchorname - String : the anchor's name. callback(success) - Function : a callback function that will be called when delet anchor completes its task, success is a boolean that will be set to true if the anchor is deleted successfully.

SpatialAnchor
var geometry = new HoloBuild.HoloBoxGeometry(0.1, 0.1, 0.1);
var material = new HoloBuild.HoloMeshBasicMaterial({ color: 'red' });
var holomesh = new HoloBuild.HoloMesh(geometry, material, true);
holoscene.add(holomesh);

HoloBuild.HoloSpatialAnchor.loadAnchor(holomesh, "holomesh", function (success) {
    console.log('holomesh anchor loaded');
});

holomesh.onTap = function () {
    holomesh.showAdjust();
    holomesh.getAdjust().onDone = function () {
        HoloBuild.HoloSpatialAnchor.setAnchor(holomesh, "holomesh", function (success) {
            if (success) {
                console.log('set success')
            } else {
                holomesh.position.set(0, 0, 0);
            }
        });
    };
};

Settings

The settings section details the various library classes that could be set by the developer.

HoloSettings

HoloSettings contains the default settings and preference of the HoloBuild Library.

Methods
  • setDebug
    (showDebug);

    This method will either enable or disable showing the console log information on your Hololens. The information will be show next the buildWagon version number. showDebug Boolean- If true the debug information will be displayed. Default is false

HoloSettings
var settings = new HoloBuild.HoloSettings();
                       
To set the debugging method:

var settings = new HoloBuild.HoloSettings();
settings.setDebug(true);