LogicBricks2

Plugins LogicBricks2

Hi HAL! Sorry to bother you but... since you are working with this sort of things I have a question for you: Is it anyway possible to show position and rotation of an atom on an UI element?
 
In principle yes, but that would need a custom script. Thinking about implementation details, I can imagine, that's a bit more on the tricky side to make it generic and configurable: Getting an atom's transform (pos/rot) is easy, turning numbers into text, also easy. Sending that text to UI controls, a bit trickier.
 
Mine was just a sneaky attempt at a request... :ROFLMAO:

You already have UI Sync that outputs things to the Atom in which it is loaded. Can't you make a similar plugin that "sipmly" make accessible POS and ROT to other plugins so that we can use UI Sync to show that values into an UIText?

Btw... your plugins are very useful! Thanks! ;)

P.s. Yes, this is a shameless corruption attempt of my inner toady.
 
Mine was just a sneaky attempt at a request... :ROFLMAO:

You already have UI Sync that outputs things to the Atom in which it is loaded. Can't you make a similar plugin that "sipmly" make accessible POS and ROT to other plugins so that we can use UI Sync to show that values into an UIText?

Btw... your plugins are very useful! Thanks! ;)

P.s. Yes, this is a shameless corruption attempt of my inner toady.
I'll give it a thought. Either extending UI_Sync (which feels wrong), or making a variant of it.
 
I'll give it a thought. Either extending UI_Sync (which feels wrong), or making a variant of it.
Maybe there are other atom's properties that may be usefull to show to other plugins... you can make a "Show me your's secrets" plugin! :LOL:
 
Could I request the FloatOperator brick has a "Multiply" operation?

Could I also request a new brick for channel selection, where it is like a ValueRelay, but with 8 inputs and a dropdown to pick which one should be the output signal?
 
For anyone who wants to use ValueMapRelay to control music or voice volume using a slider and Timeline, I wrote notes when I was working out how to do it (I know, I know, call me stupid, I just didn't find it intuitive). Figured they might be useful to someone - lol, me if nobody else....

text attached.

Catchy title: "Instructions for using ValueMapRelay Logic Brick to control absolute audiosource volume from a slider, but
fade-out using e.g. Timeline, and subsequently fade-in volume, yet only reaching absolute volume level set by UI slider."


1) Add ValueMapRelay plugin to Audiosource - or any atom of choice, for ease here, let's just put it on the Audiosource :)
2) next, select ValueMapRelay "Value Actions" = (atom)Audiosource/(receiver)Audiosource/(target)Volume Start 0.000 -> End 1.000

3) ValueMapReplay variables settings:

a) "Value" controlled by external trigger - e.g. Timeline fading volume.
b) "Input From" set to 0.000
c) "Input To" set to 1.000
d) "Output From" set to 0.000
e) "Output To" controlled by external trigger - e.g. slider for volume.

Next:

3) Add slider trigger, name "Volume"
4) Slider trigger action = (atom)Audiosource/(receiver)ValueMapRelay/(target)"Output To" Start 0.000 -> End 1.000

External trigger e.g. Timeline for volume fade:

5) Trigger action - instant or timed = (atom)Audiosource/(receiver)ValueMapRelay/(target)"Value" 0.000 to fade out,
or 1.000 to fade-in/instantly make noise again

6) Make another coffee and muse that this would've been easier to work out, if I hadn't been woken at 04:30 by neighbours
screaming obscenities at each other.

V9 UPDATE: the variable "Value" has been renamed "Input". So, same instructions but the external triggers (e.g. Timeline and slider) now target "Input" :)
 

Attachments

  • ValueMapRelay Music Volume Guide.txt
    1.4 KB · Views: 0
Last edited:
1) Add ValueMapRelay plugin to Audiosource - or any atom of choice, for ease here, let's just put it on the Audiosource :)
2) next, select ValueMapRelay "Value Actions" = (atom)Audiosource/(receiver)Audiosource/(target)Volume Start 0.000 -> End 1.000

3) ValueMapReplay variables settings:

a) "Value" controlled by external trigger - e.g. Timeline fading volume.
b) "Input From" set to 0.000
c) "Input To" set to 1.000
d) "Output From" set to 0.000
e) "Output To" controlled by external trigger - e.g. slider for volume.

Next:

3) Add slider trigger, name "Volume"
4) Slider trigger action = (atom)Audiosource/(receiver)ValueMapRelay/(target)"Output To" Start 0.000 -> End 1.000

External trigger e.g. Timeline for volume fade:

5) Trigger action - instant or timed = (atom)Audiosource/(receiver)ValueMapRelay/(target)"Value" 0.000 to fade out,
or 1.000 to fade-in/instantly make noise again
That's exactly the way to do it :) (and that's actually why I wrote that plugin in the first place).
Would you be OK if I link to this tutorial in the plugin page description as an example?
 
Last edited:
Could I request the FloatOperator brick has a "Multiply" operation?

Could I also request a new brick for channel selection, where it is like a ValueRelay, but with 8 inputs and a dropdown to pick which one should be the output signal?
Multiply: Can do, easy, just might backfire if somebody has used range extension on the inputs and the result is outside of [0...1]
Multiplexer: I was thinking about that already. At the moment, there's some kind of that in the BooleanOperator for 2 channels - I'll also add that to the FloatOperator for symmetry, but I can imagine you'd quickly need more than 2 channels ;-)
 
HAL9001 updated LogicBricks2 with a new update entry:

v7: (BREAKING CHANGE) FloatOperation Multiplication and UI_TransformSync plugin added

THIS UPDATE BREAKS PREVIOUS scenes that use FloatOperation!!!
  • As requested by @Voithe, added a plugin that can display (but not change) the transformation (Position/Rotation) of an object in a UIText.
  • As requested by @mechanimus, added a Multiplication operator to FloatOperation.
    During that move, I removed the "Value 1" and "Value 2" operations I had introduced just before...

Read the rest of this update entry...
 
Very interesting extension, but regarding the PerlinNoiseMovement section, can we further expand the functionality? For example, a butterfly needs to fly around a character's head, but the current function can only bind to one parent atom, not to the character's joints. There is also a small issue. When setting an atom (entity) to randomly move around its parent atom, it can penetrate any object, including the parent atom, walls, floors, etc., and has no control over its movable position (currently only suitable for torches). Can we change the upper and lower limits of the movement axis, such as Xmin to Xmax, instead of simply ± X, and add the parameter of the minimum distance from the parent atom? I think this is a very perfect idea.
 
That's exactly the way to do it :) (and that's actually why I wrote that plugin in the first place).
Would you be OK if I link to this tutorial in the plugin page description as an example?
Hi! Yes, absolutely! Feel free just to rewrite it as your own. And thank you for the plugins - top work ?
 

This goes far beyond my expectations. Very awesome! ?

I think there is just a little issue: When parenting the UIText like SUBSCENE => UIButton => UIText the VAM UI of the UIText doesn't show the parent atom (UIButton) (i mean in the field next to the button used to select a parent atom). The UIText is actually parented. It's just a "visual" problem.

Note that this maybe related to other things in my scene but you may want to take a look. ;)
 
Very interesting extension, but regarding the PerlinNoiseMovement section, can we further expand the functionality? For example, a butterfly needs to fly around a character's head, but the current function can only bind to one parent atom, not to the character's joints. There is also a small issue. When setting an atom (entity) to randomly move around its parent atom, it can penetrate any object, including the parent atom, walls, floors, etc., and has no control over its movable position (currently only suitable for torches). Can we change the upper and lower limits of the movement axis, such as Xmin to Xmax, instead of simply ± X, and add the parameter of the minimum distance from the parent atom? I think this is a very perfect idea.
Hmmm, that idea of stating another atom as base, not the parent is something I did in another (soon to come) Plugin, so I can copy that code across at some point.
The xMin/xMax can easily be addressed by offsetting your actual center to (xMin+xMax)/2. Unless you want dynamic control on each of the axes, but that could still be done with this mathematical trick.
The minimum distance thing is much trickier and would change the nature of the plugin, so probably not happening, sorry.
 
This goes far beyond my expectations. Very awesome! ?

I think there is just a little issue: When parenting the UIText like SUBSCENE => UIButton => UIText the VAM UI of the UIText doesn't show the parent atom (UIButton) (i mean in the field next to the button used to select a parent atom). The UIText is actually parented. It's just a "visual" problem.

Note that this maybe related to other things in my scene but you may want to take a look. ;)
That sounds more like a subscene thing in VaM to me. beyond my control.
 
Multiply: Can do, easy, just might backfire if somebody has used range extension on the inputs and the result is outside of [0...1]
Multiplexer: I was thinking about that already. At the moment, there's some kind of that in the BooleanOperator for 2 channels - I'll also add that to the FloatOperator for symmetry, but I can imagine you'd quickly need more than 2 channels ;-)
Big Thank You for the multiply change!
 
Hmmm, that idea of stating another atom as base, not the parent is something I did in another (soon to come) Plugin, so I can copy that code across at some point.
The xMin/xMax can easily be addressed by offsetting your actual center to (xMin+xMax)/2. Unless you want dynamic control on each of the axes, but that could still be done with this mathematical trick.
The minimum distance thing is much trickier and would change the nature of the plugin, so probably not happening, sorry.
The functionality of the plugin is even better than expected,wonderful !!!
 
HAL9001 updated LogicBricks2 with a new update entry:

v7: (BREAKING CHANGE) Renamed BinaryOperator / Added Float/BoolSelector

THIS UPDATE BREAKS SCENES THAT HAVE USED BinaryOperator.
  • Again, for consistency purposes (sorry, I hope this is the last time), renamed BinaryOperator to BoolOperator. This is a breaking change, but can easily be fixed by opening a scene JSON file in a text editor (e.g., Notepad++) and replacing all "BinaryOperator" with "BoolOperator".
  • As requested by...

Read the rest of this update entry...
 
Hey HAL, does such a logic brick exist (in your edition or the original) to generate a random number between two specified points? And if not do you think it could be a possible future logic brick in LogicBricks2? I can't actually remember why I want this now, since I'm pretty sure I found a hack job work around to do what I was trying to achieve - but I just remember spending a LONG time figuring it out, and thinking "this would be a useful logic brick for people like me" the whole time.

I use a combination of VUML, ActionGrouper and the LogicBricks plugins to achieve a lot of custom features in my scenes. Each are fantastic for their own reasons, but your expansion on LogicBricks has proven invaluable so far. Thank you!
 
Hey HAL, does such a logic brick exist (in your edition or the original) to generate a random number between two specified points? And if not do you think it could be a possible future logic brick in LogicBricks2? I can't actually remember why I want this now, since I'm pretty sure I found a hack job work around to do what I was trying to achieve - but I just remember spending a LONG time figuring it out, and thinking "this would be a useful logic brick for people like me" the whole time.

I use a combination of VUML, ActionGrouper and the LogicBricks plugins to achieve a lot of custom features in my scenes. Each are fantastic for their own reasons, but your expansion on LogicBricks has proven invaluable so far. Thank you!
MacGrubers set has "ValueRandom" to get a random number between 0 and 1 on a trigger. You could then use ValueMap to convert to any other range between 0 and 1. Outside of 0/1 is always tricky as the VaM event system doesn't really like that.
 
I have another idea for an ExponentialValueMap, where you'd choose an exponent (e.g. between 0.1 and 10), and the output is just input^exponent. If you restrict the input range to 0-1 only, it means the output range is also 0-1.
It'd mean I can have triggers where smaller values mean more (exp < 1), and others where only the larger values actually matter (exp>1).
 
I have another idea for an ExponentialValueMap, where you'd choose an exponent (e.g. between 0.1 and 10), and the output is just input^exponent. If you restrict the input range to 0-1 only, it means the output range is also 0-1.
It'd mean I can have triggers where smaller values mean more (exp < 1), and others where only the larger values actually matter (exp>1).
Agree, that's part of a ValueMap extension I had in mind anyway: A curve applied to the unified value: Exponent, Sinusoidal, Log/Pow
because I need that just now for a scene of mine where the heartbeat is supposed to grow louder just shortly before the orgasm... perfect application of an exponent function. v9 will come soon ;-)
 
Back
Top Bottom