Book Image

Babylon.js Essentials

By : Julien Moreau-Mathis
Book Image

Babylon.js Essentials

By: Julien Moreau-Mathis

Overview of this book

Are you familiar with HTML5? Do you want to build exciting games and Web applications? Then explore the exciting world of game and Web development with one of the best frameworks out there: Babylon.JS. Starting from the beginning, the book introduces the required basics for 3D development and the knowledge you need to use the Babylon.js framework. It focuses on the simplicity provided by Babylon.js and uses a combination of theory and practice. All the chapters are provided with example files ready to run; each example file provides the previously learned features of the framework. Finally, developers will be ready to easily understand new features added to the framework in the future.
Table of Contents (15 chapters)
Babylon.js Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Using conditions to control the actions graphs


In the previous sub-topic (the available actions), the conditions in actions were bypassed. In fact, every action can have a condition that controls whether the ActionManager executes the action or not. The conditions can check whether a value is one of the following states compared to another value:

  • Equal
  • Lesser
  • Greater
  • Different

There are three types of condition, as follows:

  • State condition: This checks whether the .state property of BABYLON.Node is equal to the given state. A state is a string.
  • Value condition: This checks whether a property is equal, lesser, greater, or different from a given value.
  • Predicate condition: This calls a custom method that will return true or false.

If an action has a condition, the action will be executed only if the condition returns true.

Adding conditions to your actions graph shows all the power of the Actions Builder, which comes in the next topic. To understand the following example, before practicing with conditions...