A simple state machine

Other A simple state machine

This uses the free CollidersAsTriggers plugin, to enable the three collision triggers around the sphere. This lets you use swipe gestures on the controller. You can move the side colliders further, higher, etc. This would be much more difficult with invisible sphere colliders, to say the least.

It also has a holding rig set up so that it will float all around one of your hands w/out ever colliding with it. Just pinch and flick to rotate into another position, and use the usual method to give it the hand-off hold.

I used the SimpleStateMachine to build the controller. The "Edit" / "Editing" trigger when the EditSphere touches the StateSphere, would otherwise take a series of sets of triggers that would be a pain to navigate through to make adjustments. With the SimpleStateMachine, it's just one Start-Collision trigger: Controller.Next. And on the End-Collision trigger, the same exact thing: Controller.Next. Setting the UIText and the color, etc., was just done via the UI while the plugin essentially creates and ties a trigger to any/all changes I made to the controller. It was... simple.

Some rounds of testing revealed my first iteration of the in-game VR controller could explode on load, if a collider that is turned off via the helper plugin would collide with another object before VaM gives the plugin system a chance to choose which colliders to disable.

This has postponed the release of the in-game VR controller and the sample scene. Instructions for how to quickly set up the CyperPunkApt with Person item to create two "sane" states for getting to know the SimpleStateMachine are provided.

Because I had to rework the controller, I am using my own plugin on it (it is a SubScene after all, which I specifically designed the state machine to be attached to (if not to a person directly)). This has helped me play with ideas that have yielded a much better version of that initial controller, so that will be worth the wait.

Hoping the scene physics setup I am putting together as I type (after I eat) is also worth the wait. :)

spoiler: Being somewhat active in the Discord has its benefits *wink, wink - work-in-progress

---

Usage:
(note: saving is not enabled - this version is for playing around with. If not being able to save is upsetting, that means you must like the capabilities. Please show support. Coding contributions, free membership patreon tier level... all welcome)

  1. Attach to a SubScene Atom, or because it is tested for the case, throw a Person in CyberPunkApt.
  2. Parent the Person to that/a SubScene.
    1. Try adding additional lights, some toys, etc... and set all of them to be parented by the Apt/Subscene...
  3. THEN, once everything you want as a child of your state machine sees that Apt/Subscene as its parent...
  4. Move the person into the shower doorway, if the former.

    The plugin will auto-create two state collections for you.

  5. Go to the Plugin's UI and toggle on BOTH Play and Edit.
  6. Press Next a couple of times, and watch the Plugin UI scroller iterate back and forth between 1 and 2.
  7. Now you're ready to start editing your first state.
    1. Go ahead... I'm not stopping you. Don't stare at the plugin UI. Go create your state. Use your fav. plugin to give the person idle movements - dress things up. Set up the lighting such that it yields a mood...
  8. If using the CyberPunkApt
    1. Move the person from the shower doorway, straight back, to the shower wall -- not into the shower, yet - just further inside, to that back wall.
    2. Turn on the shower, Change some of the lights. Go back to the plugin's UI, and press Next.
      1. From here, you can add slots, and add more states, and start playing with "small" movement transitions.
        I myself like to use the Player's main controller UI to set their max velocity to 0.01, their damper to 0, and their joint spring "percentage" to about 7 (equates to a value of 700 for hold spring, for every controller). I make sure to do it before creating too many states so that I don't have to go back and adjust the main characteristics I wanted, by iterating through and changing them later.

  • Careful not to put a collider between the person btwn states in this version as it was made for small, incremental movements.

  • To make a backup of your current state, just add a state. It is stacked to the end of the list.
  • To undo changes made before iterating back or forth while Edit is on (which would save that state), just click "Revert Unsaved Changes".
  • Replacing one state with another is a little less straightforward in this initial version.
    • You'll have to navigate to the state you want to replace the other with, make sure you "Played" into that state.
    • Now toggle off both Play and Edit, and Hit Next/Previous until you get to the state you want to replace.
    • No states should be overriden while Edit is toggled off.
    • Toggling off Play just lets you avoid jumping into states on the way to the target one.
    • Once the target state index is reached, toggle back on Edit, then go Prev/Next.
I've read while researching asset creation, that it is best to release smaller components of your plugins or scenes first, so I have started releasing components that improve usability for my state machine. The first is a simple plugin to turn basic shapes and atoms into passthrough collision triggers. The native spherical CollisionTrigger Atom is great, but I wanted non-spherical shapes, and to be able to track my collider visually, ie. with a mesh. This was the easiest way I saw to achieve that.

Two more releases planned over the weekend. Next is the 1st draft of the in-game VR widget that will do everything that can be done via the plugin's menu.

The last is a starter scene pack, with the plugin attached to the CyberPunkApartment, and some items / physics setups placed about to help users get familiar with the plugin's capabilities.
Back
Top Bottom