extensions

GUIObject


##new GUIObject(mesh, guiSystem)

Creates a new GUIObject from a babylon mesh, and add it to the GUI system given in parameter. The given mesh layer mask is updated to GUISystem.LAYER_MASK. Each object can be linked to an action, called when the user clicks/touch the object. The name of the GUIObject is the mesh name.

####Parameters | Name | Type | Description ---|---|---|--- | mesh | BABYLON.Mesh | The Babylon mesh to add in the GUI system

| guiSystem | GUISystem | The gui system

##Members

###mesh : BABYLON.Mesh The babylon mesh.

###guiPosition : BABYLON.Vector3 The position of the panel in the GUI world (values in pixels)

###guiSystem : GUISystem The GUI System

###onClick : function(BABYLON.ActionEvent) → void A callback function called when the object is clicked or touched (if hand.js is included). This function is not set when a new GUIObject is created.

##Methods

###guiposition(BABYLON.Vector3) → void Set the gui position of this object (values in pixels)

###relativePosition(BABYLON.Vector3) → BABYLON.Vector3 If the argument is not present, returns the relative position of this element.
If the argument is present, set the relative position of this element according to the GUI width/height. This example will set the position of the object at 50% of canvas width, and 25% of canvas height:

var rp = new BABYLON.Vector3(0.5,0.25,0);
obj.relativePosition(rp);

The GUI system world is used for relative position.

###position(BABYLON.Vector3) → void If the argument is not present, returns the position of the mesh.
If the argument is present, set the position of the mesh. The Babylon unit system is used for this function.

###scaling(BABYLON.Vector3) → void If the argument is not present, returns the scaling of the mesh.
If the argument is present, set the scaling of the mesh. The Babylon unit system is used for this function.

###dispose() → void Dispose this GUI object

###setVisible(boolean) → void Set this GUI element to visible or invisible