You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mike Lewis edited this page Feb 12, 2016
·
1 revision
FormulaEngine Concepts - Bindings
Some things just make more sense to stash in the low-level game engine (that is, in the C++ code) versus in the FormulaEngine scripting system. For example, the coordinates of a physics object should be accessible in native format to the C++ physics implementation. To avoid having to copy that coordinate data back and forth from FormulaEngine to the C++ layer, we use a system of bindings.
Bindings allow FormulaEngine to directly read and write native data handled by C++ code. There are two types of bindings: properties and goal states.
Binding Properties
Binding properties are a means by which FormulaEngine scripts can read data out of C++ territory. They cannot be assigned new values by script, but they can change at any time in C++. Simulation components that live in C++ should expose their data to FormulaEngine scripts using binding properties.
Goal States
Goal states offer a channel through which scripts can assign desired values to objects in C++. This can be used for direct setting of data, although it makes more sense typically to think of a goal state as something a script wants to see happen. The C++ code is not contractually obligated to make this state "real" - if multiple conflicting states are assigned to the same goal by different scripts, the C++ code is free to resolve the conflict in any way that makes sense.