Puzzles Libraries — Soft8Soft
Description: Using Verge3D Puzzles library, a persistent storage for groups of puzzles for re-use in multiple projects.

# Libraries for Your Puzzles

Library is a persistent storage for groups of puzzles for re-use in multiple projects.

## Contents

- Introduction
- Adding Entries
- Using Entries
- Renaming Entries
- Deleting Entries
- Backup
- Stock Library Reference
  - Alert Message
  - Auto-Rotate Camera
  - Color Picker
  - Context Menu
  - Detect Pressed/Released
  - Hovered Cursor
  - HTML Dialogs
  - Inquiry Form
  - Keyboard Controls
  - Performance Tweaks
  - Preloader
  - Prepare Sound
  - URL Params
  - VR Controls

#

## Introduction

There are two libraries in Verge3D:

- Stock Library — stored in library.xml file inside the puzzles subfolder of the installation folder. This is a read-only library which is built in Verge3D. See below for the reference.
- User Library — stored in my_library.xml file inside the applications folder. You can add your own puzzles to this library.

#

## Adding Entries

You can add a puzzle group to the user library by right-clicking on it and selecting the option Save N Puzzles to Library. In the modal window type the name for the group as it will appear in the library's list of entries. Refresh the list of entries by reloading the page with the Puzzles editor to update that list.

#

## Using Entries

A saved group of puzzle can be retrieved from the library by dragging it out to a workspace.

#

## Renaming Entries

There is no dedicated control for renaming library entries. However, you can easily rename an entry by editing the `my_library.xml` file located in the applications folder.

Once renamed, your library entry name will be updated after refreshing the editor.

#

## Deleting Entries

An entry can be deleted from the user library by clicking the ❌ button.

#

## Backup

Every time you save or delete entries, the previously saved file my_library.xml is copied to the folder called library_backup with a timestamp added to the file name.

This allows you to restore any of the previously saved revisions of your user library when you need it. Simply copy a file back to the application folder and remove the time stamp from its name. Your library will be updated after refreshing the editor.

#

## Stock Library Reference

Below is the reference of the entries of the stock puzzles library which comes with Verge3D.

#

### Alert Message

Displays an alert message at the bottom of the screen. For example, you can use it to obtain a user's consent before processing their personal data.

Here you can specify both the text shown in the alert message and its styling.

For usage example, check out the Custom Image demo (source files available in the Asset Store).

#

### Auto-Rotate Camera

Automatically rotates the active camera upon inactivity.

Here you can specify rotation delay and speed.

#

### Color Picker

Creates a color picker attached to the specified 3D object.

Replace Cube (Blender), Box001 (3ds Max), or pCube1 (Maya) with the actual object name and CubeMaterial (BoxMaterial/standardSurface1) with the actual material name. Also select proper material node input.

#

### Context Menu

Disables the default browser context menu replacing it with a custom menu (which pops up when the user right-clicks on the 3D object).

Replace Cube (Blender), Box001 (3ds Max), or pCube1 (Maya), menu items, and event handlers in the actual app.

#

### Detect Pressed/Released

The puzzle when clicked does not allow you to separate "down" and "up" movements of the mouse buttons (or pressing/releasing fingers on the touchscreen), hence it's not possible to catch the moment when the mouse is actually pressed (or released). The following set of puzzles allows this:

Replace Cube (Blender), Box001 (3ds Max), or pCube1 (Maya) with the actual object name and the print to console puzzles with the actual blocks you need in your app.

#

### Hovered Cursor

Detects when the mouse cursor is located just above the target object, then changes the mouse cursor to look as "pointer", thus hinting the user that this object is clickable.

Replace Cube (Blender), Box001 (3ds Max), or pCube1 (Maya) with the actual object name. If you need to perform something different in your app beyond simple cursor styling, replace the set style puzzles as well.

For usage example, check out the Ring demo (source files available in the Asset Store).

#

### HTML Dialogs

This library entry includes snippets to create and display various dialog windows:

#### OK Dialog

Shows a simple dialog window with text and "OK" button:

Replace "You are doing great!" inside the set prop puzzle with your own text.

#### Yes/No Dialog

Shows a dialog window with text and "Yes"/"No" buttons:

Replace "Would you like to proceed?" inside the set prop puzzle with your own text. You can also assign your own labels (and values) for "Yes"/"No" buttons.

The logic processing the return value (aka button pressed) of the dialog is located at the end of the snippet:

We use the on event of → close puzzle to catch the moment the dialog closes and extract the actual return value using the get prop puzzle.

#### Login Dialog

Shows a login dialog with the email and password fields:

Replace "Enter your credetials to sign in" inside the set prop puzzle with your own text. With minimal modifications this snippet can also be converted to a sign-up (registration) dialog.

All snippets inside the "HTML Dialogs" entry contain the showModal puzzle in the end. This forces the corresponding dialog to open once the puzzles run. Place "showModal" somewhere else (e.g. inside when clicked or on event of) to open the dialog on demand.

#

### Inquiry Form

Displays a dialog with an inquiry form which can be sent via WordPress plugin or another form processing service.

By default, the dialog appears when clicking on the Cube object and displays a form with Name and Email fields:

The form can be freely customized to your needs. Don't forget to specify the name property for all form inputs.

Replace sandbox.soft8soft.com with your own form service! Verge3D Sandbox will accept your form data, but throw it away immediately.

#

### Keyboard Controls

Use this library entry to detect keyboard strikes.

Replace ArrowLeft/ArrowRight with the actual keys, and the print to console puzzles with the actual blocks you need to be executed in your app.

Key values are just letters (e.g. "w", "a", "s", "d") you type on your keyboard. Also it can be special values like "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Enter", "Tab", "Home", "End", "Delete", "Escape", " " (for space), etc. See here for a complete list of keys.

For usage example, check out the Farmers Journey demo (source files available in the Asset Store).

#

### Performance Tweaks

Use this library entry to optimize quality and performance of your applications. On high-end devices with HiDPI screen this set increases pixel density for better rendering quality. For low-end devices this set removes all post-processing effects and disables shadows which should greatly increase rendering performance on such devices.

This library entry does not require any additional tweaks and is recommended for use in all Verge3D applications.

#

### Preloader

Creates a preloader screen with the same elements and styles as the native app preloader.

This preloader can be displayed while loading or appending new scenes or when something resource-intensive occurs in your app (e.g. fetching or uploading some data, performing calculations etc). Good thing is that this preloader will retain all the look customizations you apply to your app.

The library entry itself contains 3 snippets used for creating, updating, and removing the preloader. For example, to show a preloader while the append scene puzzle fetches, parses, and appends a new scene, use the following snippet:

#

### Prepare Sound

This library entry helps overcome restrictions for playing sounds on iOS/Android devices.

Replace mySound.mp3 with the actual sound you have in your app.

#

### URL Params

Saves/restores values as URL params. The value can be a number, text, list/vector, or dictionary.

Saving/restoring values as URL params allows for preserving the application state (e.g. product configuration, user preferences, contact info, etc.) and provides it as the modified URL address. This new address can be bookmarked for later app use, sent to other people, or shared on social media.

In this library entry we're saving/restoring a vector position of the Cube object (as `my_value` variable). Replace the corresponding puzzle with your own code.

#

### VR Controls

Moves in VR mode by using the device controls (touch pad or stick). This set of puzzles should work with most VR controllers available on the market provided they conform the xr-standard layout.

Replace collision_mesh with the actual collision mesh used to control the zone the camera can move within. Basically, the zone above this material is walkable, while everything outside is forbidden for movement.

Also make sure you have enable the sitting or standing VR positioning mode. Check out the enter VR mode puzzle for more info.

## Having Troubles with Puzzles?

Seek help on the forums!