LogicBricks

Plugins LogicBricks

Hi,
first of all, thanks for the update.
I'd like to request a feature to enable/disable the plugins. Currently, they trigger even if disabled. For most of the scripts, the change required is super simple.
Example from ValueRelay:

Code:
        private float value;

        private void Update()
        {
            if (enabled) myFloatTrigger.Update();
        }

        public void OnEnable()
        {
            myFloatTrigger.Trigger(value);
        }

        private void Trigger(float v)
        {
            value = Mathf.Lerp(myRangeMin.val, myRangeMax.val, v);
            if (enabled) myFloatTrigger.Trigger(value);
        }

Thanks and have a great day
 
Disabling the plugins is not a good idea, as someone might be using Timer-Triggers that need the continious update. As atani said, that's what "AcceptTrigger" is for. And yes, not all bricks have that because I'm lazy ;) (actually rather lack of time) I might add it eventually, but no promises.
 
Last edited:
Hi @MacGruber !

The RandomAnimation brick is awesome!! Nice update!

Then... i have a little issue with the SelectChoice brick (maybe note really an issue). When we are configuring a trigger to call the function that select a choice, we have to write by hand the exact name of the choice. I think it would be better if we can select the choice from a list.

Is this intended? Are there any cases where it's better this way?
 
When we are configuring a trigger to call the function that select a choice, we have to write by hand the exact name of the choice.
Note that you can copy&paste text when in Desktop mode. So, usually you wouldn't "type by hand", which reduces chances for typos at least.

I think it would be better if we can select the choice from a list.
Yes, it would. Actually the new SoundFromAB brick uses something like this.
However, back when I implemented the SelectChoice and StateMachine bricks I had some issue with the trigger connection being deleted in some situations when loading the scene. Don't remember the exact details, but I think it had something to do with the loading order of atoms in a scene. That depends on the order you added them to the scene, which is nothing the plugin could control. So, if the atom with the trigger was loaded before the brick was loaded, it didn't know which choices it should have...meaning thought it had none, resetting the connection. As said, don't remember the exact details, that was two years ago, but something like that. It may have been a VaM bug long fixed (it seems to works with SoundFromAB now), but I don't have the time to reimplement all the bricks. IdlePoser has the same issue. Also making the change would break existing scenes. There are creators who have thousands of LogicBricks trigger connections in their scenes.
 
@MacGruber Howdy! I'm playing with the new SoundFromAB bricks and I have a couple observations.
  • Minor comment, but it is possible to change the default location to Custom\Assets for selecting the audio assetbundle?
  • I setup an Audio timeline trigger to PlaySpecific from AB (music assetbundle I made), at the start of the animation.
    • I found it starts playing right away even though timeline is stopped. It also starts playing when I click stop and reset in timeline.
      • So if I switch to that animation, it starts playing even though the animation is stopped.
    • I know this is a timeline specific thing, but thought I would ask if you have any ideas.
 
I setup an Audio timeline trigger to PlaySpecific from AB
As you noticed yourself, that's a Timeline thing, but not nessarily ans "issue". It behaves as a coder would expect ;)
The trigger triggers when a particular time is reached. If you set that to 0.0, then it obviously triggers when the animation time reaches 0.0. Resetting timeline is likely pretty much the same as just setting the time to 0.0....so it correctly triggers ;)
Probably try setting your trigger time to 0.05 or something like that.

Minor comment, but it is possible to change the default location to Custom\Assets for selecting the audio assetbundle?
Would have to try (no VaM access from here), but I think right now it remembers the last folder location you used with that particular dialog window. Simply because I'm not setting a folder at all? So the next time you use the plugin in your VaM session you would be in the correct folder already (whatever that may be). That should even work across plugin instances in a scene? If I set a default folder, that wouldn't work anymore? So the current behavior seems more suited for power-users like @Slam Thunderhide who have thousands of audio files in their scene.
 
As you noticed yourself, that's a Timeline thing, but not nessarily ans "issue". It behaves as a coder would expect ;)
The trigger triggers when a particular time is reached. If you set that to 0.0, then it obviously triggers when the animation time reaches 0.0. Resetting timeline is likely pretty much the same as just setting the time to 0.0....so it correctly triggers ;)
Probably try setting your trigger time to 0.05 or something like that.


Would have to try (no VaM access from here), but I think right now it remembers the last folder location you used with that particular dialog window. Simply because I'm not setting a folder at all? So the next time you use the plugin in your VaM session you would be in the correct folder already (whatever that may be). That should even work across plugin instances in a scene? If I set a default folder, that wouldn't work anymore? So the current behavior seems more suited for power-users like @Slam Thunderhide who have thousands of audio files in their scene.

The timeline thing is strange. The Audio triggers are supposed to sync with the animation, so the audio triggers normally don't start playing automatically and stop when you stop the animation. It only starts playing automatically when using the AssetBundle triggers. Again, this is probably a timeline thing that Acid would have to account for.
 
Hi. I use some of your logic bricks all the time. Delay and State machine are two of my favs. I did notice a potential bug with State machine. When you use the "reset pose" button on the "Control & Physics 1" tab, all your states get deleted on any state machine plugin used on the figure.

Also, second question. Is the Delay plugin the only one that has the ability to set a delay? Is there one that you can set up various potential triggerable actions but where they all fall under the same plugin? I currently use a bunch.
 
Hi. I use some of your logic bricks all the time. Delay and State machine are two of my favs. I did notice a potential bug with State machine. When you use the "reset pose" button on the "Control & Physics 1" tab, all your states get deleted on any state machine plugin used on the figure.

Also, second question. Is the Delay plugin the only one that has the ability to set a delay? Is there one that you can set up various potential triggerable actions but where they all fall under the same plugin? I currently use a bunch.
If you don't need multiple delays simultaneously (as in no other delay is triggered before the current one finishes) you could (ab-)use the state machine for that.
  • create a default "off" state
  • create all your "triggerable actions" as states with the delay as duration and set their default transition to the off state.
  • put your actions into the OnExit triggers
 
If you don't need multiple delays simultaneously (as in no other delay is triggered before the current one finishes) you could (ab-)use the state machine for that.
  • create a default "off" state
  • create all your "triggerable actions" as states with the delay as duration and set their default transition to the off state.
  • put your actions into the OnExit triggers
Ah...good idea.
 
I did notice a potential bug with State machine. When you use the "reset pose" button on the "Control & Physics 1" tab, all your states get deleted on any state machine plugin used on the figure.
@Slam Thunderhide reported something similar a few days ago. Found the issue by now, general undocumented weirdness of VaM. It affects likely almost ALL of my plugins. Some of them will loose data partially, which may be even worse than losing everything.
Strong recommendations:
  1. DO NOT USE LEGACY PRESETS! That includes "Reset Pose" and "Reset Look" buttons. Create yourself a new Pose preset with a T-Pose, if you need it. With those there shouldn't be trouble.
  2. Save your scene regularly. Every few minutes, if you need to. It never hurts to have a backup ;)

Also, second question. Is the Delay plugin the only one that has the ability to set a delay? Is there one that you can set up various potential triggerable actions but where they all fall under the same plugin? I currently use a bunch.
Besides abusing a StateMachine, you could also use a Delay that triggers a SelectChoice. Benefit over the StateMachine is that you could change the duration of the Delay by trigger, if you need that.
 
@Slam Thunderhide reported something similar a few days ago. Found the issue by now, general undocumented weirdness of VaM. It affects likely almost ALL of my plugins. Some of them will loose data partially, which may be even worse than losing everything.
Strong recommendations:
  1. DO NOT USE LEGACY PRESETS! That includes "Reset Pose" and "Reset Look" buttons. Create yourself a new Pose preset with a T-Pose, if you need it. With those there shouldn't be trouble.
  2. Save your scene regularly. Every few minutes, if you need to. It never hurts to have a backup ;)


Besides abusing a StateMachine, you could also use a Delay that triggers a SelectChoice. Benefit over the StateMachine is that you could change the duration of the Delay by trigger, if you need that.
Thanks. Yeah, I don't usually use the legacy poses, but occasionally do for a reset. I'll create a new preset for that, as you mentioned. As for your suggestion regarding SelectChoice...how does the delay know which choice I want it to trigger? I'm assuming I would trigger the delay...which in turn then triggers the select choice, correct?
 
Thanks. Yeah, I don't usually use the legacy poses, but occasionally do for a reset. I'll create a new preset for that, as you mentioned. As for your suggestion regarding SelectChoice...how does the delay know which choice I want it to trigger? I'm assuming I would trigger the delay...which in turn then triggers the select choice, correct?
You would trigger it by setting which choice to use on the SelectChoice, then triggering the delay. The Delay would then trigger SelectChoice, which then does what you set it to do earlier.
 
There's a technique that C&G uses a lot, which allows for independent asynchronous execution of multiple delayed triggers.
He uses animations combined with collision triggers. It seems a bit cumbersome to set up but it's super clean and works well. No idea what his work flow is, though.
If you prefer a coding approach over hooking into VaMs animation runtime you could probably implement all that with AcidBubbles Scripter.
 
I feel like this should be easy, but I'm trying to add a small delay in between calls to Audiomate plugin on an Atom. I have tried the Random Delay and Delay bricks by installing those plugins both on the same atom and by calling them from a dedicated atom with just the delay plugin, but no luck. Any quick pointers?


BTW, I have looked and played with the Demo for both of those bricks but I can't see what I'm doing wrong for some reason.
 
I feel like this should be easy, but I'm trying to add a small delay in between calls to Audiomate plugin on an Atom. I have tried the Random Delay and Delay bricks by installing those plugins both on the same atom and by calling them from a dedicated atom with just the delay plugin, but no luck. Any quick pointers?
Without more details I can only guess. LogicBricks in general usually works with triggers. So, you need a trigger connection from your "dedicated atom" to the Delay brick. Then, from its "Actions OnTrigger" slot, have the Delay brick trigger AudioMate.
There are also a couple of video tutorials around. While it's possibly quite annoying to listen to my ramblings, there is a lot of info in there:
 
Howdy, been trying to work it out myself but I'm not too adept at these plugins and triggers yet so I was hoping somebody here may have some insight. I'm looking to make a fairly basic toggle switch using a UIButton atom, I'd like to be able to press it once and trigger a few things at the same time (more specifically, trigger a plugin in another atom), then press it again and activate different triggers (for use as an "end" or "off" action). Like I said, just a basic toggle switch function, but I really can't figure out how to do it without any specific "toggle" triggers on the atoms I want to trigger and without using a UIToggle atom (which I know would probably work fine but I'm being picky about how it looks for some reason). Any help is appreciated, again, I'm pretty new to this. Thanks in advance.
 
@js567488
There are two ways, depends what you need exactly:
  1. Using two buttons. Just have one button turn itself off and then turn on the other. So you swap between the buttons.
  2. Use a StateMachine with two states to cycle through. Each states just waits for the "TriggerSync" signal which it gets from the button, then transitions to the other state. Because we can....I also made it utilize the duration of states for nicely fading the sphere in/out. This can also handle button mashing, since the State does not transition before the duration is run out, so a button click too quickly after another is just ignored as it is common practice for such things.
Made you a quick example scene containing both, uses LogicBricks.14
1684403022897.png
 

Attachments

  • ButtonToggleExample.json
    28.4 KB · Views: 0
There are two ways, depends what you need exactly:
  1. Using two buttons. Just have one button turn itself off and then turn on the other. So you swap between the buttons.
  2. Use a StateMachine with two states to cycle through. Each states just waits for the "TriggerSync" signal which it gets from the button, then transitions to the other state. Because we can....I also made it utilize the duration of states for nicely fading the sphere in/out. This can also handle button mashing, since the State does not transition before the duration is run out, so a button click too quickly after another is just ignored as it is common practice for such things.
Made you a quick example scene containing both, uses LogicBricks.14
Thank you very much! The fact that you made an example scene is truly above and beyond! These are both great in their own ways but I believe I will use the StateMachine, you've explained it very well and it'd be good for me to experiment with it, it does seem like a very powerful plugin. I've been a bit intimidated by some of your LogicBricks plugins to be honest, but from what I've seen and tried myself, taking the time to experiment with them and learn what they can do (I see you have some very nice video tutorials, those will help a lot) seems like it would definitely be worth the effort. Thanks again!
 
Last edited:

Similar threads

Back
Top Bottom