Objects Puzzles Reference — Soft8Soft
Description: How to manage your 3D objects with Verge3D Puzzles.

# Objects

The puzzles from this category perform various operations with objects.

## Contents

- Puzzles Reference
  - show
  - hide
  - is visible
  - clone object
  - create object
  - remove object
  - set transform
  - get transform
  - change local transform
  - snap to object
  - parent
  - set object direction
  - get object direction
  - get objects from
  - set morph factor
  - get morph factor
  - make object from
  - add annotation
  - remove annotation
  - open annotation
  - close annotation
  - create text object
  - update text object
  - get object dimension
  - distance
  - get custom props
  - outline
  - set shadow param
  - update light probe object(s)
  - create instances

#

## Puzzles Reference

#

### show

Makes a specified object, that was initially or previously hidden, visible. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle. If there is no such object(s) present in the scene, or an object is already visible, does nothing.

#

### hide

Makes a specified object invisible. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle. If there is no such object(s) present in the scene, or an object is already invisible, does nothing.

#

### is visible

Checks if an object (or any of objects in a list) is currently visible. If it so, returns the logical value true, otherwise returns false. If there is no such object(s) present in the scene, returns false.

#

### clone object

Makes an object copy, generates a unique name for the new object and immediately adds it to the scene. Outputs the new object name. Does not work with lists, groups or the all objects puzzle.

This puzzles supports additional options which can be activated via the gear icon:

also clone materials
  By default the "clone object" puzzle does not perform material cloning, hence the same material will be assigned to the cloned object. Enable also clone materials if you wish to clone the material (or materials) as well.
preserve object groups
  By default the "clone object" puzzles resets object groups for the cloned object. Enable preserve object groups to transfer groups from the original object.

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

#

### create object

Creates and adds a new object to the scene. This puzzles creates objects without the need in a 3D editor, and as such is useful for learning visual programming as well as designing primitive visuals by users with no or minimal 3D modelling skills. By using this this puzzle in combination with make object from you can create rather complex geometry.

For geometry objects, such as boxes or teapots, this puzzle also creates white-colored dielectric node-based PBR material (with roughness value set to `1` and metalness set to `0`). Use the set color and set value puzzles to tweak that material.

For plane with texture objects, this puzzle assigns a dummy checker texture to the model. Use the replace texture puzzle to change this texture.

The plane with html option is used to create planes which render HTML-based resources, such as websites, custom UIs, or YouTube videos.

Internally this feature uses a 3D-transformed `<iframe>` element which has the width (in pixels) specified in the res input.

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

#

### remove object

Removes a specified object from the scene. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle. If there is no such object(s) present in the scene, does nothing.

#

### set transform

Moves, rotates or scales an object according to specified transform data. The offset checkbox enables moving/rotating/scaling an object relatively to the original position/rotation/scale. Any of the axis inputs can be left blank. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle.

Sometimes you need to input a vector (which consists of the given X, Y, Z coordinates). In this case, you can modify the puzzle by clicking on the gear icon and setting on checkbox use vector. The world space checkbox enables transformations in world space (does euler rotation in XYZ order), otherwise does transformations in object's space.

#

### get transform

Retrieves the position, rotation or scale data of an object. To retrieve transformations in world space click on the gear icon and set on checkbox "world space" (retrieve euler rotation in XYZ order). Does not work with lists, groups or the all objects puzzle.

#

### change local transform

Moves, rotates or scales an object according to specified transform data in its local space. Any of the axis inputs can be left blank. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle. Sometimes you need to input a vector (which consists of the given X, Y, Z coordinates). In this case, you can modify the puzzle by clicking on the gear icon and setting on checkbox use vector.

#

### snap to object

Moves an object to the position of another object by copying its transform data. Also copies rotation and scale. Does not work with lists, groups or the all objects puzzle.

#

### parent

Creates a parent relation between objects, so that the first object follows position/rotation/scale of the second one. Does not work with lists, groups or the all objects puzzle.

Specify <none> as the second value to unparent the object.

#

### set object direction

Set an object's direction to the point/vector with X, Y, Z coordinates. The point checkbox specifies whether the X, Y, Z coordinates belong to some point in 3D space or represent a direction vector. The lock up checkbox locks the up-down axis of the object so it remains perpendicular to the horizontal surface.

Sometimes you need to input a vector (which consists of the given X, Y, Z coordinates). In this case, you can modify the puzzle by clicking on the gear icon and setting on checkbox use vector.

For example, to make some object look at the camera, use the following puzzles:

#

### get object direction

Returns an object's direction vector or numeric X, Y, Z vector components.

#

### get objects from

This universal puzzle allows you to:

- get the list of objects contained in a group thus making it iterable
- convert the output of the all objects puzzle to a list thus making it iterable
- get children of some parent object
- filter objects by their kind (e.g. cameras, lamps, annotations, etc), full name, or partial name
- convert object names to unique IDs and vice versa

By using the dropdown you can filter off objects of a kind:

- all — get all objects
- annotation — get only annotation objects
- bone — get only bones
- camera — get only cameras
- empty — get only empty objects
- mesh — get only meshes
- light — get only lights
- first — get the first object found; use this option with the name filter to retrieve the first object matching the name

For example, you can use the following puzzles to direct all mesh objects on the scene to look at the camera:

The enable name filter checker in the gear popup activates the name filter input:

- equal to — match the full name
- starting with — match the names starting with the specified text, e.g. "Cube" will match "Cube", "Cube.001", "CubeGold", etc.
- ending with — match the names ending with the specified text, e.g. "Cube" will match "Cube", "MyCube", "Green_Cube", but not "Cube.001"
- including — match the names including the specified text, e.g. "Cube" will match "Cube", "MyCubeIsAwesome", "Cube2", etc.

Name filter works in a case-sensitive manner, e.g. "Cube", "cube", "CUBE" will match different objects.

The return unique object ids checker in the gear popup can be used to retrieve unique object IDs instead of names:

This option is very important in the case when having just the name is not sufficient – this is when objects are appended dynamically from another glTF file and happen to have same names. Another use-case is when you copy a parent object, which won't stop all the children from keeping their original names.

You can use the IDs obtained by this puzzle (which look like this: 5c464bf0-043a-40ee-b864-5c026436d7de) to pass them into other object puzzles.

Say you just loaded a scene named "NewCarScene" dynamically, which happen to contain a "Car" model. However, say there is another "Car" model already present in the main scene. To change the material on the newly added car, you need to use the following setup:

If you simply pass "Car" to the "assign material" puzzle, it won't work, because "FancyMaterial" will be incorrectly assigned on the first model found, which may be not what you wanted.

The "get objects from" puzzle can also be used to transform the object name to its ID (or IDs in case there are multiple objects sharing the same object name):

Other way around, in order to obtain the object name by the corresponding object ID you can do the following:

#

### set morph factor

Sets an object's morph target factor. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle.

You can set a morph target by passing the name as a text. In this case, you need to modify the puzzle by clicking on the gear icon and setting on the checkbox flexible target input:

Example:

See the source files of the Parametric Models demo and also this video tutorial explaining the basics of using morph target puzzles.

#

### get morph factor

Returns an object's morph target factor (aka value or weight). Does not work with lists, groups or the all objects puzzle.

Example:

You can set a morph target by passing the name as a text. In this case, you need to modify the puzzle by clicking on the gear icon and setting on the checkbox flexible target input:

#

### make object from

Create a new object by applying boolean (also called CSG or constructive solid geometry) operation on two input objects. If the clean checkbox is not set, the input objects are not affected and should be hidden/removed explicitly.

Example:

You can also pass a clipping plane as one of the input objects (with intersect operation). In this case, another object will be clipped.

Limitations:

1. Geometry of morphed or skinned object will be baked.
2. Objects with normal mapped materials are not not supported.

#

### add annotation

Adds a point of interest icon to an object that a user can expand by clicking on it to see some description. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle.

For example, to add an annotation to the "Cube" object with "1" as label and "This is point of interest #1" as description:

You can assign custom name for the annotation object, instead of default value, equal to the annotation label. For this you need to modify the puzzle by clicking on the gear icon and setting on the checkbox enable "name" option:

The add annotation puzzle creates 2 HTML elements (for label and description) which can be styled in App Manager settings or with CSS classes.

You can also style each individual annotation by assigning and accessing its elements' ids:

By default, an annotation obscured by some geometry is automatically closed and become semi-transparent. This behavior can be disabled by turning off the fade annotations option of the configure application puzzle.

You can use a more low-level alternative, the bind element puzzle, instead but it won't expand upon clicking and won't be obscured by geometry.

#

### remove annotation

Removes a previously added annotation from an object. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle.

#

### open annotation

Expands an annotation specified by its label.

#

### close annotation

Closes an annotation specified by its label.

#

### create text object

Generates a new text object according to the specified textual content and parameters.

Basic options:

with text
  Generated text.
font
  Font used to generate text. The following formats supported: WOFF, TTF, OTF.
size
  Rendered text size in engine units (depending on the modelling suite: meters, inches, etc.).
extrude
  Amount of extrusion applied to text glyphs.

Advanced options:

segments
  Number of segments used to render the text. Less — better performance, more — better quality.
bevel thickness
  Thickness of the text bevel.
bevel size
  Size of the text bevel.
horizontal align
  Horizontal text alignment.
vertical align
  Vertical text alignment.

#

### update text object

Updates mesh for a text object according to specified textual content. The text object should be created either by using the create text object puzzle or exported from the modeling suite.

This puzzle also works for a list of objects, a group (or a list of groups) or with the all objects puzzle.

#

### get object dimension

Outputs object dimensions as numberic X, Y, Z components or as XYZ vector in either local coordinate system (with scaling applied) or world coordinate system.

In the world mode, the puzzle also works for a list of objects, a group (or a list of groups) or with the all objects puzzle.

Usage example: drawing a text label which displays current width (in centimeters) for the dynamically scaled object.

The puzzle has some limitations. For morphed objects, it returns maximum dimensions the object can be morphed to. For skinned objects, the puzzle returns the original dimensions for the object.

#

### distance

Outputs the distance between two specified objects. Does not work with lists, groups or the all objects puzzle.

#

### get custom props

Returns a dictionary with custom properties assigned to an object.

Custom properties can be assigned in Blender by using the Custom Properties panel:

or in 3ds Max by typing properties in the Object Properties dialog:

or in Maya by using the Attributes → Add Attributes... menu in the attribute editor:

In case of Maya you need to assign additional customProperties attribute with the list of space-separated custom property names.

#

### outline

Applies or removes the outline effect to/from a specified object. Requires enabling the outline effect in Blender, 3ds Max or Maya. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle.

#

### set shadow param

Enable/disable casting/receieving shadows for the given object. Also works for a list of objects, a group (or a list of groups) or with the all objects puzzle.

#

### update light probe object(s)

Updates/rerenders the reflection cubemap for the given light probe object.

#

### create instances

Create GPU instances for the given object. Unlike the clone object puzzle it does not create a copy of an object but rather uses the capability of graphics hardware to generate geometry on the fly. This is much more efficient than rendering separate objects, as you can have dozens or even hundreds of thousands of objects easily rendered on a low-end device.

This puzzle can work with two types of inputs depending on what's more convenient for you. First, positions, rotations, scales can be groups. Individual objects from these groups will be used as instance transformations (in most cases you should just use empties/dummies).

Alternatively, you can specify lists of vectors for the corresponding inputs:

When using uniform scaling (same values for X, Y, Z coordinates), you can simplify the scales input to a list of numbers:

Whatever you choose, the rotations and scales inputs are optional and can be safely omitted. In such the case, the rotations and scales for instances will be inherited from the source object (so they will be the same for all instances).

Possible use-cases include grass, foliage, nature objects, city landscapes, fences, you name it. Basically any repeated static objects will benefit from this feature.

## Having Troubles with Puzzles?

Seek help on the forums!