LogoLogo
DocumentationWebsiteCommunityPortal
  • Get Started
    • Quickstart
    • Tutorials
    • Wizards
  • Features
    • Release Notes
      • 2024
        • 04-05 Apr Update
        • 03-27 Mar Update
        • 02-07 Feb Update
        • 01-23 Jan Update
        • 01-05 Jan Update
      • 2023
        • 12-18 Dec Update
        • 11-30 Nov Update
        • 10-30 Oct Update
        • 10-04 Oct Update
        • 09-18 Sep Update
        • 09-11 Sep Update
        • 08-28 Aug Update
        • 08-14 Aug Update
        • 07-23 July Update
        • 07-14 July Update
        • 06-16 June Update
        • 06-6 June Update
        • 05-16 May Update
        • 03-31 Mar Update
        • 03-16 Mar Update
        • 03-10 Mar Update
        • 02-07 Feb Update
        • 01-24 Jan Update
        • 01-10 Jan Update
      • 2022
        • 12-08 Dec Update
        • 11-13 Nov Update
        • 11-07 Nov Update
        • 10-26 Oct Update
        • 10-14 Oct Update
        • 10-01 Oct Update
        • 08-26 Aug Update
        • 08-02 Aug Update
        • 07-01 July Update
        • 06-08 June Update
        • 05-20 May Update
        • 05-05 May Update
        • 04-25 Apr Update
        • 02-11 Feb Update
        • 01-28 Jan Update
        • 01-10 Jan Update
      • 2021
        • 12-10 Dec Update
        • 12-01 Dec Update
        • 11-26 Nov Update
        • 11-17 Nov Update
        • 11-12 Nov Update
        • 11-09 Nov Update
        • 11-02 Nov Update
        • 10-26 Oct Update
        • 10-21 Oct Update
        • 10-14 Oct Update
        • 09-27 Sep Update
        • 08-31 Aug Update
        • 07-20 July Update
        • 07-02 July Update
        • 06-31 June Update
  • Metaverse
    • Building
      • Portal
        • Team Members
        • Defining Global Variables
      • Editor
        • File Manager
          • Selecting a file
          • Sketchfab Integration
        • Placement in 3D Space
        • Project Settings
          • Preferences
          • Branding
          • Collaborators
          • Menu
          • Variables in Settings
          • Lead Generation
          • Tour Mode
          • Advanced
          • E-Commerce in Settings
        • Preview
          • Headset Testing - WebXR Emulator
        • Viewport Properties
        • Editor Keyboard Shortcuts
      • Scenes
        • 3D Scene
          • Avatar System
          • Colliders
          • Zones
          • Lights
        • 360 Scene
        • Orbit Scene
      • Elements
        • Image
        • Video
        • Audio
        • GIF
        • Text to Speech
        • Character
        • Character AI
        • Actionbar
        • Timer
        • Polygon
        • Linked Popups
        • Variants
      • Rules
        • Shared Rules
        • How Rules Work
        • Number Variable Rules
        • String Variable Rules
        • Boolean Variable Rules
      • Variables
        • Autogenerated Variables
        • String Substitution
        • Capturing User Input
      • Build FAQs
    • Publishing
      • URL or QR Code
      • Embed on your Website
      • Full-Page HTML
      • Embedding within Apps
        • Android Embed
        • React Native Embed
      • Export as SCORM package
      • Authentication
        • SSO
        • Password With Expiry
        • Email with OTP
        • Custom List
        • Token
        • Load from another Experience
      • Publishing FAQs
      • Private Cloud Deployment
    • Multiplayer
      • Host Mode
      • Broadcast Mode
      • Voice Chat
      • Text Chat
      • Video Chat
      • Screenshare
      • Comments
      • Share Reactions
      • Notifications
      • Troubleshooting webcam and microphone
    • Analytics
      • Advanced Analytics
      • Leaderboard
      • Viewer Sessions
    • Integrations
      • GMetri with SCORM
        • Embed a SCORM package in a GMetri experience
      • Live Stream on GMetri
        • Live Stream Zoom on YouTube
        • Live Stream Zoom on Vimeo
          • Zoom Setup
      • E-Commerce with GMetri
        • Shopify Integration
        • WooCommerce Integration
        • Custom Integration
        • Using an E-Commerce Plugin
      • Adding a Chatbot
      • Sending data to GMetri Deployment
    • Viewing
      • Avatars
      • First/Third Person
      • Concurrency
      • Oculus Controls
      • Viewer Keyboard Shortcuts
      • IT Permissions
        • Whitelisting for Viewing Experiences
        • Whitelisting for Editing Experiences
        • Whitelisting for Analytics
        • Subprocessors
    • GMetri SDK
      • GMetri Player
      • GMetri SDK APIs
        • Project
        • Deployment
        • File
        • Viewer Group
      • GMetri Webhooks
      • API Token
      • Examples
  • Guidelines/Compatibility
    • Guidelines
      • Content Creation Guidelines
        • XR Experience Storyboard
        • 360 Degree Video Shoots
        • Avatars vs Characters
        • Designing 3D Models for Immersive VR mode
      • Asset Guidelines
        • 3D Models
          • Export GLB/GLTF from 3DS Max
          • Export GLB/GLTF from Blender
        • 360 Pano Images Render
        • Resources for Assets
        • Asset FAQs
        • Image Aspect Ratio
      • Experience Optimizations
        • Scene Optimizations
          • Performance Monitor
        • Image Optimizations
        • Audio Optimizations
        • Video Optimizations
        • 3D Model Optimizations
      • Workflows
        • Green Screen
          • Apply Green Screen to Videos
          • Accurate Color Selection
        • QR Code Scanner
        • Adding Sprites
        • Adding Background Music & Persistent Logo
        • EmbedHTML Snippets
    • Compatibility
      • Platform Requirements - Viewer
      • Platform Compatibility Matrix
      • Supported File Formats
      • Supported Browsers
      • Capture Network and Console Logs from Chrome Browser
    • Limitations
      • iOS Limitations
      • VR Mode Limitations
  • Platform
    • Billing
    • Platform FAQs
    • Security
    • Legal
Powered by GitBook
On this page
  • Number: When Rules
  • Number: Then Rules
  • Number: Formulas
  • Mathematical Expressions
  • Random Number
  • Current Time

Was this helpful?

Edit on GitHub
Export as PDF
  1. Metaverse
  2. Building
  3. Rules

Number Variable Rules

PreviousHow Rules WorkNextString Variable Rules

Last updated 1 year ago

Was this helpful?

Use Number Variables to track the number of times a viewer performs an action or to store a score or any other number.

Example Experience where you can track the number of times the viewer enters a zone:

(Try walking into the blue zone and see the count increment)

These are the rules that were used in the above experience:

Number: When Rules

  1. changes: Gets triggered if the number variable undergoes a change.

  2. is between: Gets triggered if the number variable is within a certain range.

  3. is =, is >, is > OR =, is <, is < OR =: Comparison operators that trigger when the given condition becomes true.

  4. is in the list / is not in the list: A certain action can be triggered if the number value exists in a given comma-separated list.

Number: Then Rules

  1. reset to default value - This will set the variable back to its default value.

  2. set to number - This action allows you to set the variable to a particular number.

  3. set to formula - This action enables you to use a formula that generates results to set the value of the variable.

  4. add number - This action allows you to add a particular number to the variable.

  5. add captured value - This action adds the captured value to the variable (instead of replacing it with the value).

Number: Formulas

You can do a lot with the Then option set to formula for Numbers.

Mathematical Expressions

You can write any formula in the "Set to formula" value to get it evaluated by GMetri.

The following types of expressions are supported:

Input
Result
Explanation

2+3-1

4

Addition and Subtraction operator

2*5/10

1

Multiplication and Division operator

tan45 or tan(45)

1

Trigonometric Function (tan in Degree mode)

tan45 or tan(45)

1.619775190543862

Trigonometric Function (tan in Radian mode)

Pi1,15,n or Pi(1,15,n)

1307674368000

Product of Sequence

Sigma1,15,n or Sigma(1,15,n)

120

Sum of Sequence (also called summation)

2^3

8

Exponent (note this operator is left associative like MS Office)

5P3

60

Permutaion Method to calculate all the permutaions

sincostan90 or sin(cos(tan(90)))

0.017261434031253

Multiple functions with or without parenthesis (both works)

Random Number

Set the "Set to formula" value to random_<from>_<to> to generate a random number. Replace "<from>" and "<to>" with numbers, no spaces in between - like random_0_5. For example, if you want to generate a random number between 3 and 8, you should set this to random_3_8.

Current Time

Set the "Set to formula" value to current_time to save the current epoch time (in ms) in a number variable.

Rules used in the above experience:

Rules - Number Variables
Number: When Rules
Is In List Rule

capture data - This action copies the value from the "When" side of the rule. Check .

Number: Then Rules

Formula expressions also support .

Formula based rules
Variable Substitution
Example Experience to track how many times the viewer enters the blue zone
Number: formulas
#capturing-user-input