Bogdan posted this, calling it Pretty Lights... They indeed are pretty, aren't they?
These types of lights are typically known as chaser lights, and I organized a general formula that you can use in order to use them yourself. Note, this is slightly complex, so you will need to read through to use it yourself.
Here it is, in all its glory:
ceil(clamp(cos((360/a)*(Time - b)),c,1) - c)
The following is the explanation of some variables. You need to decide these in the order presented.
a
is the cycle repeat interval, in seconds. e.g. ifa = 4
, then your chaser loop will repeat every 4 seconds.b
is the chaser light offset. This is a tad bit more complicated, it'sa
divided by the number of lights in your chaser loop. (a / n
, n = number of lights)c
is the light toggle duration parameter. This is how long each light is on for. To obtain a value forc
, use the following formula:cos((360/a)*(b/2))
. You can roughly round it. Make sure to use degrees mode for your calculator.
That's not the end of it, though- when you set up your lights and input the code, you don't put in the same thing for every light. This is a bit hard to explain, so I'll give you an example first.
I'll use 5 lights with a 2 second repeat cycle. That means:
a = 2
n = 5
b = 0.4
c
=cos((360/2)*(0.4/2))
=cos(180*0.2)
= about0.809
and if we input the found values into our code:
ceil(clamp(cos(180*(Time - 0.4)),0.809,1) - 0.809)
HOWEVER!!!
The setup is a bit more than just copypasting that code. Instead, for the first light in your setup, use the same formula, but without b
. (0*b
). For the second, use the same formula with b
(1*b
). For the third, use the same formula with 2b
(2*b
)... repeat until the last light. This allows for the correct offset to be made, making the smooth look.
For the sake of your convenience, I'll list all the code for this particular example.
- Light 1:
ceil(clamp(cos(180*(Time)),0.809,1) - 0.809)
- Light 2:
ceil(clamp(cos(180*(Time - 0.4)),0.809,1) - 0.809)
- Light 3:
ceil(clamp(cos(180*(Time - 0.8)),0.809,1) - 0.809)
- Light 4:
ceil(clamp(cos(180*(Time - 1.2)),0.809,1) - 0.809)
- Light 5:
ceil(clamp(cos(180*(Time - 1.6)),0.809,1) - 0.809)
This one that Bogdan uses the exact same code from the example I gave.
I hope that made sense. Any questions in the comments I will answer, but only if you are being specific.
For more Funky Trees resources, visit:
Awesome code!
is there any way to make the 5 lights throttle sensitive (the lights run with 0 throttle and speed up relative to the % of throttle)?
@NATCH abs(clamp(Yaw, 0,1))
Ahh guys anyone know how to invert a light beacon?
Like for example they will separately activate depending on what direction the yaw will move
Like i hold the yaw on left the left beacon light will activate, the same on the right side. Thank everyone who's going to respond
It works great! Thanks for the help. I tried to read the funky trees instructions but they don't make a whole lot of sense lol.@SnoWFLakE0s
@Hedero
.
I probably need more context, but here goes nothing:
clamp(VTOL,-1,0) + Roll
I have tried and tried but funky tree codes seem to surpass the limits of my knowledge. I wish I could understand them more to improve my aircraft's performance like BogdanX does. But for now, I guess I'll remain simple. I'm trying to figure out how to make flaperons without using two rotators. I can make a super simple code that allows roll and VTOL but the VTOL goes up and down. I only want VTOL to have a negative value, not a positive one. While also allowing the roll to move up and down. What would the code be for something like that?@SnoWFLakE0s
That’s unfortunate... @SnoWFLakE0s
@shipster
.
No.
Is there a “distance from target” code? I’m trying to make a countdown to fire a weapon
@SnoWFLakE0s no problem
@nadvgia
.
Fixed. Thanks.
Link does not work
@SnoWFLakE0s I just wanted to make AI to player (Its called Mech Neuralink)
@BuiltBionixInd10
.
AI has nothing to do with this particular system. As for certain other types of systems, I have yet to test that.
@SnoWFLakE0s does AI work or fit with funkytrees
@SnoWFLakE0s does the AI know how to use funky trees
@Stormfur
.
Probably is somewhere, although this the method I was sure was going to work 100%. I use what works. You have any other periodic functions that sinusoids? Not really...
Nice. But isn't there simpler ways to do that exact same function?
@spefyjerbf
.
Definitely- I've also been thinking about the possibility of arcade games using a system like this.
@DickBrazen
.
Nah, it's an username I came up with many years ago, just out of randomness.
Nice. I did something like this on the lighting of my most recent build too! It’s a fun way to make a design come alive.
Why are you big brain?