LogicBricks

Plugins LogicBricks

MacGruber updated LogicBricks with a new update entry:

Version 10

Among other things, two new bricks for LogicBricks. These will be needed for the Benchmark project to reduce motion sickness as much as possible. Due to the locked VR head tracking, motion sickness is a problem in that scene you usually would not have to this degree. So I need to use every trick in the book, at least those that won't affect benchmark results, to reduce it as much as possible. In this case fading to black before teleporting...

Read the rest of this update entry...
 
Hi @MacGruber I love the logicbricks. I'd like to ask for a (small) feature for the state machines. I'd like to be able to set the minimum and maximum duration timer for each state, from outside. The use case would be a dance scene where the BPM of the music changes on user choice, which also means the transitions of the dance states need different duration times. Do you think that could be included in some future release?

Right now a very messy workaround would be using delays which trigger when a state is entered, but then I'd also need separate random choice logic, instead of being able to use the transition logic which the states already have.
 
Hi @MacGruber I love the logicbricks. I'd like to ask for a (small) feature for the state machines. I'd like to be able to set the minimum and maximum duration timer for each state, from outside. The use case would be a dance scene where the BPM of the music changes on user choice, which also means the transitions of the dance states need different duration times. Do you think that could be included in some future release?

Right now a very messy workaround would be using delays which trigger when a state is entered, but then I'd also need separate random choice logic, instead of being able to use the transition logic which the states already have.
The problem with setting values for individual states is that it would need some way to specify which state you want to modify. For enabling/disabling states I use two string triggers. That works because a boolean only has two possible values. Of course I could do it as two step trigger, the first is a string parameter where you set the StateName you want to interact with, and any parameter you change afterwards via trigger would affect that state. Its a bit of a hassle to use, though? (but better than formated strings where you set like "stateName@value" or something, which would be terribly slow when used in large scale)

For now I would recommend a Delay or RandomDelay brick that triggers TriggerSync on the StateMachine. Just have a zero-duration State that has "wait for trigger sync" enabled. In its OnEnter it would trigger the Delay brick, which would then eventually use the TriggerSync signal to exit the current state. That way the Delay does not need to know which state you are in, you can use a single Delay for all states. Note that because the StateMachine does not know the actual duration of the state, the OnValue trigger won't give you any useful values.
 
The problem with setting values for individual states is that it would need some way to specify which state you want to modify. For enabling/disabling states I use two string triggers. That works because a boolean only has two possible values. Of course I could do it as two step trigger, the first is a string parameter where you set the StateName you want to interact with, and any parameter you change afterwards via trigger would affect that state. Its a bit of a hassle to use, though? (but better than formated strings where you set like "stateName@value" or something, which would be terribly slow when used in large scale)

For now I would recommend a Delay or RandomDelay brick that triggers TriggerSync on the StateMachine. Just have a zero-duration State that has "wait for trigger sync" enabled. In its OnEnter it would trigger the Delay brick, which would then eventually use the TriggerSync signal to exit the current state. That way the Delay does not need to know which state you are in, you can use a single Delay for all states. Note that because the StateMachine does not know the actual duration of the state, the OnValue trigger won't give you any useful values.
Thanks a bunch! Your workaround is a lot smarter than mine. Thanks for thinking with me!
 
I'm trying to implement simple IF/AND logic into a scene I'm working on, but I'm overwhelmed by the many scripts available. Anyone have any pointers on how to achieve this? It involves person A taking an action if either B or C actors have taken their action, but A will only revert their action if both B & C have reverted their actions. Any help would be appreciated.
 
LogicBricks does not really have variables and boolean logic. You could use vUML for that:

An alternative could of course be to use a "can-do-everything" LogicBricks StateMachine. You description is very vague...but something like 4 states: "None", "B", "C" and "BC" to store whether B and/or C took their action. Then use the MultipleChoice system to define what state to switch to if A, B or C take/revert actions.
 
LogicBricks does not really have variables and boolean logic. You could use vUML for that:

An alternative could of course be to use a "can-do-everything" LogicBricks StateMachine. You description is very vague...but something like 4 states: "None", "B", "C" and "BC" to store whether B and/or C took their action. Then use the MultipleChoice system to define what state to switch to if A, B or C take/revert actions.
Thanks for the reply. I had the scene on paper, but hadn't done it yet. What I'm wanting to do is have actor A spreading their legs when either actor B or actor C take their action. But Actor A will not close their legs unless actor B AND C reverse their action. If my logic is sound it would be:
A=1, if either B or C = 1.
A=0 if B AND C = 0.
 
Thanks for the reply. I had the scene on paper, but hadn't done it yet. What I'm wanting to do is have actor A spreading their legs when either actor B or actor C take their action. But Actor A will not close their legs unless actor B AND C reverse their action. If my logic is sound it would be:
A=1, if either B or C = 1.
A=0 if B AND C = 0.
StateMachine is probably the way to go. It makes it easier to deal with animations, assuuming your transition from 0 to 1 is not instant.
 
MacGruber updated LogicBricks with a new update entry:

Version 11

Version 11 introduces two new bricks, SequenceMachine and SequenceChoice.

Changelog for LogicBricks v11
  • SequenceChoice: Similar to RandomChoice and SelectChoice. However, each time it's triggered, it executes the next item in the sequence. There is also a RandomShuffle option. This was a request by lapiroman.
  • SequenceMachine: This is a variant of the same, but with more powerful options. It's similar to...

Read the rest of this update entry...
 
MacGruber updated LogicBricks with a new update entry:

Version 12

Version 12 just adds a small feature to the ValueRelay brick.

Changelog for LogicBricks v12
  • ValueRelay: Adding RangeMin/Max sliders, so you can remap the value range. This allows you to adjust range of a float trigger via trigger.
  • Updated demo scenes to refer current versions of packages.

Read the rest of this update entry...
 
Great pluggin MacGruber! I really enjoy it!

I was wondering how I could do something.

I have Character A with a collision trigger attached to it, which trigger an event when Character B enters in collision with it.
- On the trigger, I do use your "Random Action", that will trigger one of the 3 Acid Bubble Timeline animations that are existing into the Character A plugin.

It does work perfectly. As soon as Character B enter the collision trigger around Character A, one of the 3 animations is played randomly.

BUT the problem I have in that I would like the animations to continue to be played randomly as long as Character B is in the collision trigger area. As it is right now, only one animation is played. If I Character B exit the collision trigger area, a new animation will be played when he will enter again. So it does work, but just once per collision.

Anyway to keep animation looping as long as Character B stays in the collision area?
 
I'm not that familiar with Timeline, but I think you can just enable that Loop checkbox on the animations and have a trigger on End of collision that has Timeline go back to the original animation?
 
Great pluggin MacGruber! I really enjoy it!

I was wondering how I could do something.

I have Character A with a collision trigger attached to it, which trigger an event when Character B enters in collision with it.
- On the trigger, I do use your "Random Action", that will trigger one of the 3 Acid Bubble Timeline animations that are existing into the Character A plugin.

It does work perfectly. As soon as Character B enter the collision trigger around Character A, one of the 3 animations is played randomly.

BUT the problem I have in that I would like the animations to continue to be played randomly as long as Character B is in the collision trigger area. As it is right now, only one animation is played. If I Character B exit the collision trigger area, a new animation will be played when he will enter again. So it does work, but just once per collision.

Anyway to keep animation looping as long as Character B stays in the collision area?
You can play your animations randomly in timeline itself. But if its not what you need, you should try VUML. There you can set variables, counter etc. for me I'm trying to do all things with Master Acidbubbles Timeline and Master MacGrubers Logikbricks. Also im using the Idleposer to start animations on certain events. Sorry for my bad english, I'm german ^^
 
@SPQR Both the "walking and object tracking logic" as well as the "texture painting" sound like something that shouldn't be done via LogicBricks, but a proper dedicated plugin instead? Note that my Connect plugin already allows you to have a TCP connection to an external server, although it can only send, not receive a response. Simply because I didn't need a response for the stuff I'm doing with it.
 
This is an incredible pack of plugins! The possibilities seem endless here! I’m still trying to wrap my head around everything. Quick question…what’s the easiest way to have the screen fade on a UI button click and then have the fade become inactive? I can figure out how to trigger the fade, but then I can’t figure out how to make it go away.
 
What's the correct way to reference MacGruber_Utils.cs from within another plugin?

Let me explain what I'm trying to do:
I've created an experimental plugin that can sync anything to an AudioSource-frequency.
For example I can flash a spotlight to every bass-beat at 200 Hertz.
The idea here is to automatically sync and visualize things in the scene more precisely.
It seems by default it is only possible to use the audio volume for that. That not good enough.

To pass a frequency float value from my plugin I used MacGruber_Utils.cs.
I've added a FloatTrigger that's used by Utils.SetupButton.
Everything works and it looks F-ing cool in realtime! (y)
Except MacGruber_Utils.cs is being referenced by using a .cslist-file and is placed in:
E:\VaM\Custom\Scripts\Sally\MacGruber\LogicBricks\Internal\MacGruber_Utils.cs
If I do not do that, VAM tells me the MacGruber namespace can not be found. Makes sense since VAM doesn't know where it is.

TLDR:
Can I somehow reference the Utils inside E:\VaM\AddonPackages\MacGruber.LogicBricks.12.var without the need to add a MacGruber_Utils.cs-copy to my plugin?

Sorry if this is a very noob question. I've never touched C# and this is my first attempt to create a plugin. My only experience is from coding a C++ audio-3D-visualization-tool for clubs in the late 90s when the first 3D accelerator cards became mainstream on PCs.

Also: Is it possible to draw custom things like an equalizer or graph in the plugin panel? I've noticed there seems to be some custom UI code for the trigger-panel in Utils.
 
This is an incredible pack of plugins! The possibilities seem endless here! I’m still trying to wrap my head around everything. Quick question…what’s the easiest way to have the screen fade on a UI button click and then have the fade become inactive? I can figure out how to trigger the fade, but then I can’t figure out how to make it go away.
If you want to use LogicBricks, you might just want to use the StateMachine. Use 4 states, one for button "on", one for button "off" and two more for the fade.
 
TLDR:
Can I somehow reference the Utils inside E:\VaM\AddonPackages\MacGruber.LogicBricks.12.var without the need to add a MacGruber_Utils.cs-copy to my plugin?
Sure, you can just refer to the VAR in your *.cslist. That should be MacGruber.LogicBricks.12:/Custom/Scripts/MacGruber/LogicBricks/Internal/MacGruber_Utils.cs
Note that when you create your own VAR, that reference won't be detected automatically, if nothing else is in your VAR is using that version of LogicBricks, you have to add the reference manually to your meta.json.

The alternative of course is to just include MacGruber_Utils.cs in your own plugin, which is possible if you release under CC-BY-SA.

Also: Is it possible to draw custom things like an equalizer or graph in the plugin panel? I've noticed there seems to be some custom UI code for the trigger-panel in Utils.
You can use normal Unity UI, so you can do everything. However, its very tedious if you have to do everything from code. You might want to consider building the UI in the Unity Editor, load it as prefab from an AssetBundle and then have your plugin connect to it. For example my Benchmark plugin does that.
 
I’ve been using the play random sound brick in my new scene. It’s working great, but for some reason it won’t recognize the newest sound files that I’ve added to my scene. The sound files are listed on my scene audio, but the plugin won’t find them when I scan for them. Any ideas?
 
I’ve been using the play random sound brick in my new scene. It’s working great, but for some reason it won’t recognize the newest sound files that I’ve added to my scene. The sound files are listed on my scene audio, but the plugin won’t find them when I scan for them. Any ideas?
Things to try:
  1. Do your new audio files actually play? If the file path is wrong or something, the plugin will just ignore them.
  2. Have you tried restarting VaM and reloading your scene? ("Have you tried turning it off and on again?")
 
I'm trying to figure out how to do something, and a discord member said I might be able to use Counter logic brick to do it but I'm not really following how.

I'd like to have a sphere interact with 2 collision triggers.
I want the one collision trigger to increase the value of a body morph while colliding with the sphere.
I want the other collision trigger to decrease the value of a body morph while colliding with the sphere.
If the ball is touching neither collision trigger I want the body morph value not to change.

So far I have tried doing something like getting the collision trigger to change to the maximum value I want to permit over say, 5 seconds but only be activated while colliding with the sphere. It initially appears to be working, in the sense where if I remove the sphere from colliding, the body morph does stop, but as soon as I touch it back to the collision trigger the morph "jumps" to a further value. So it doesn't make a smooth value change.

I guess basically I want the body morph value to increase or decrease by X amount when the sphere is colliding with the trigger, not be "set" to a certain value over X seconds which only appears to make it change gradually but doesn't actually work.

Can logicbricks help me do this or can I do it with the built in tools?
 

Similar threads

Back
Top Bottom