hai-vr / av3-animator-as-code

Generate animator layers and animations from a fluent builder syntax. Initially designed for use in VRChat, this is now a generic package that does not require it.
https://docs.hai-vr.dev/docs/products/animator-as-code
MIT License
190 stars 14 forks source link

[Enhancement] Allow taking arbitrary boolean expressions #1

Open kitlith opened 2 years ago

kitlith commented 2 years ago

From this limitation, conditions with nested OR cannot be expressed easily, such as:

  • 🚫 (F && (G || H) && (J || K))

As I understand it, state transitions naturally follow/allow for Sum Of Products boolean expressions. (each transition contains a number of ANDs between different conditions, and then you can OR the result of each transition together). Since any boolean expression can be rewritten into a Sum Of Products (SOP) form, we should be able to take any expression, rewrite it in SOP form, then generate the transitions accordingly.

Finding a SOP expression given an arbitrary expression shouldn't be too difficult, i think. Finding the optimal SOP expression is likely out of scope.