Scene Rules, Actions, and Functions

Scene Rules, Actions, and Functions are Snap code blocks which control the appearance of the 3D Scene, and allow you to make the scene dynamic.


Unlike most other rules of the rule cycle which are found in the Configurator, scene rules are found in the scene itself.  Since one configurator can display one of many different scenes, based on the business rules at hand, it makes sense to have the scene visual components and logical components stored and managed together in the scene.

Scene logic is stored in rules: from the logic for hiding and showing the meshes of product options, to the logic of reacting to user keyboard clicks while the scene is in focus. When the scene is linked to a configurator, the configurator’s rule cycle extends into the scene, running the scene rules after every edit the user makes to the configurator.

These scene rules are managed in workspaces. Rules in these workspaces are either run automatically as part of the rule cycle, or in reaction to events.

If you want... Then create a... Example

To store a reusable block of code in your scene so it can be used many times.

Global rule

  • A subroutine that determines what components should be shown or hidden in the scene, and their position in space.

  • A custom type to help you manage the data for an array of objects which need their positions calculated.

The scene to respond to a change made in the configurator.

Scene rule

  • Change the color of an object in the scene to match the color your user selected in the configurator.

To perform a task only once, just before the scene opens on-screen for the first time.

Scene Loaded Event

  • Ensure a certain list of objects in the scene are invisible at first, and only appear when needed.

To react to a keypress the user makes while the scene is in focus.

Keyboard Event

  • Let your user use keystrokes to move a component’s position, or move from one viewpoint to another.

To perform a task when the user enters xR Mode: this replaces the current environment with live video from the user’s camera. It allows them to see scene objects in virtual reality or augmented reality.

XR Enter Event

  • Hide any hotspots, so your user sees the product in their real-world context without any distractions.

WebXR is a new standard. Device vendors like Apple can choose to not support WebXR in web browsers. Some scene features in XR may not be compatible with some devices. Learn more about Epicor CPQ system requirements.

To perform a task when the user leaves xR Mode: this stops the live video from their camera, so they return to seeing the default environment.

XR Exit Event

  • Restore hidden hotspots in the scene.

To show a button next to the scene that’s always visible.

Action

  • Give your user a button to “Enter Car” that animates the car door open, and then animates the camera to a new viewpoint in the car’s interior.

  • Give your user a “Night” button that changes the scene lighting from day to night, and activates your product’s safety lights.

To perform a calculation based on scene geometry calculated automatically by the scene itself, and expose that calculation to another system, like the related configurator.

Function

  • If your user drags a pipe valve to a new location, allow the scene to determine if the new position collides with any other pipes or valves in the assembly. A function in the scene can gather up information about the collision, or the new valve’s position, and expose that spatial information when it is called by the scene’s configurator.

To show 2D content floating over the 3D scene.

Hotspot

  • Show your company logo in the corner of the scene, no matter where your user moves the camera.

  • Pop-up a portion of your configurator (such as a select list of color options) within the scene, next to the mesh in question, for easy selection.

  • Pop-up an explainer video next to a part, showing how it can be installed or serviced.

To add some fields or other UI elements to your stand-alone scene.

Page

Show a slider control for reflectivity of a material, so your testers can run the scene, easily adjust the reflectivity of a material, and inform you which setting looks the best.

The pages element appears in the design tree only if this scene is set to “standalone” in its properties. When associated with a configurator, the pages from that configurator UI is used.

 

Understanding Scene Rules

Regardless of which of these scene rule workspaces you use for some logic, keep the following in mind:

  • Scenes read data from configurators, but don’t write data back.
    When it comes to the friendly relationship between a configurator and a scene, the configurator is in charge. The configurator is both the source of data that describes the custom product (stored in fields) and the business logic which controls its configuration (stored in configurator rules). The scene, on the other hand, follows the configurator. The scene can get field data from a configurator, and scene rules can organize scene elements to give a visual representation of the configurator, but not write information back to a configurator.

    If you want to send information from a scene back to the configurator – such as the new position of a mesh which has been dragged or a key that was pressed – use a message rule, or call a scene function.

 

Was this article helpful?