Logic Parts

From Homebrew Patent Unknown Wiki
Jump to navigation Jump to search

Some parts in Homebrew use the blue Logic connectors to communicate with each other. Using this ability you can create a multitude of circuits, from applying the brakes when you get out of your vehicle to a vehicle that can move autonomously while reading its environment.

Logic Boxes

Toggle box.png Toggle Box

The Toggle box allows you to mimic a pressed button. Connect and press a key/button from a Seat to the Input and press it once to turn on (1), press again to turn off (0). Input values must be at least 0.5 in order to activate the Toggle Box and change its state. Holding the button down will not do anything, only pressing it will. In terms of electronic logic, the Toggle Box is "rising edge sensitive" and requires a digital signal (not analog).

Examples
  • Use this to turn an Engine On/Off.
  • Use with and Electric Switch to turn Lights On/Off.
Inputs
  • Activate - Keeps the part activated as long as the input is at least 0.5.
Properties
  • Current Toggle - Makes the Toggle Box on by default, if checked.
Outputs
  • Binary - A value that is always either 0 or 1.


Modify box.png Modify Box

The Modify box is probably the most used box in Homebrew logic. It allows you to invert and/or multiply/divide values. It can also be used to to create If Logic using the minimum/maximum values. It also allows you to offset the input value if needed, or take the reciprocal of some number.

Examples
  • Use Coefficient to adjust a number
  • Use min/max values to limit range of movement of a WingFlap, steered Simple Wheel Hub, Rotator, Hemi Servo, etc.
  • Use Invert to change negative signal into positive, useful when using the negative throttle axis for braking.
  • Use a Modify Box with an Offset at 1 to output a fixed value (in this case, always outputs 1).
Inputs
  • Logic - A number sent and received by parts that use logic.
Properties
  • Offset - A number representing the amount added to the input value.
  • Logic Min - The minimum value that will output. Values below will output this value instead.
  • Logic Max - The maximum value that will output. Values above will output this value instead.
  • Coefficient - A number an input is multiplied by before it is used by the part.
  • Divisor - Any number set here will become the denominator in an fraction. For example, setting the number 2 here, and inputting the number 30 into the Modify Box will cause it to output 15.
  • Invert - This function takes the additive inverse of the input number. In other words, it makes positive inputs into the negative version, and negative inputs into their positive version.
  • Reciprocal - The reciprocal of any number is the multiplicative inverse, also known as dividing 1 by said number. It turns numbers like 10 into 0.1, and numbers like 0.2 into 5.
Outputs
  • Logic - A number sent and received by parts that use logic.


Combine box.png Combine Box

When you want to connect multiple inputs to a single box, you'll need a Combine box in between. This box allows you to add, multiply, divide, or average 2 or more values together into one output value.

This is the second most used logic box in Homebrew, after the Modify Box.

Examples
  • Use this to allow two or more inputs to affect the same part.
  • You can also use it just to add two values by setting it to Addition mode.
  • It is also possible to subtract by first using a Modify Box and inverting a number to be negative before connecting it to the Combine Box.
  • It can also be used as a multi-trigger Transistor of sorts by setting it to Multiplication and having all but one input be Binary, and having the only input that isn't binary be the value you would like to pass through.
Inputs
  • Logic - A number sent and received by parts that use logic.
Properties
  • Mode - Sets the math function used by the combine box. Can be Addition, Multiplication, Average (Arithmetic Mean), or Division.
Outputs
  • Logic - A number sent and received by parts that use logic.


Transistor box.png Transistor Box

The Transistor acts like an On/Off switch. Connect the value to activate/deactivate the Transistor on the Trigger input, and connect the value you want to affect on the Input. The box is "triggered" (on) whenever the Trigger input is equal to, or greater than, the Value To Trigger property. While the box is triggered it will output the value that is sent to the "Input" input. While the box is not triggered it will only output 0, regardless of inputs. The "Triggered By Default" property can be used to make the Transistor triggered by default, making values sent to the Trigger input untrigger (turn off) the transistor.

Examples
  • Use this to turn On/Off things that deal with logic values (blue connectors).
  • Use after a Shift Box to change value to 0 when Off and back to Shift Box value when On.
Inputs
  • Trigger - A logic value that causes the Transistor to send an output, as long as it is greater than the Value To Trigger.
  • Input - A value sent across the blue Logic Line.
Properties
  • Triggered By Default - If ticked, causes the Transistor to allow inputs to pass through by default. While ticked, activating the Trigger causes the Transistor to stop outputting.
  • Value To Trigger - The value sent to the Trigger input must be at least as large as this value in order for the box to output.
Outputs
  • Logic - A number sent and received by parts that use logic.


Memory Box.png Memory Box

The Memory Box allows you to hold a value as long as you want. It has 2 modes, referred to as Set and Add modes. In Set mode, whenever the Set input is activated the box will store the value at Input into memory. Add mode instead adds the value at Input to memory whenever the Set input is activated. The Memory Box is in Set mode by default, and can be switched to Add mode by checking the "Add Input To Value" property. The Memory Box's output will always output the stored value, regardless of any settings.

Examples
  • Use to make a timer, store start/end times and then calculate the time difference.
  • Use to make a counting device by using Add mode and giving the Input a constant value of 1. Then it will count up every time the Set input is triggered.
  • Can use multiple to store part (or all) of an XYZ coordinates from the GPS Box.
Inputs
  • Logic - A number sent and received by parts that use logic.
  • Set Value - Depending on the mode selected, when activated, this will either replace the currently stored value, or add the input value to the stored value.
  • Clear - When activated, this will reset the stored value to 0.
Properties
  • Add Input to value - This will add the input value to the stored value in memory.
  • Require input change to set - If checked, requires that whatever input sent to Set must change before the box will Set again. Used to prevent the box from saving/adding every tick.
Outputs
  • Logic - A number sent and received by parts that use logic.


Shift box.png Shift Box

This logic box allows you to smoothly increase/decrease a value stored inside the Shift Box. It will stay at that value unless you change it, but can be reset using the Clear input. Connecting logic wires to its Increase/Decrease inputs will smoothly increase or decrease the stored value, depending on the values sent to those inputs, and multiplied by the Speed setting of the Shift Box itself. The Axis input can be used to do both, depending on whether the input is positive or negative.

Examples
  • Use this to control the throttle on a rocket or engine (instead of just on/off).
  • Use it to adjust/trim a value while using the vehicle, like a rudder, elevator, etc.
  • Use two in conjunction with a Navigator Box in order to input values for custom X and Z coordinates.
Inputs
  • Increase - Slowly increases the stored value by the input over 1 second.
  • Decrease - Slowly decreases the stored value by the input over 1 second.
  • Axis - Changes the stored value by the input slowly over one second. Positive numbers increase it and negative numbers decrease it.
  • Clear - When activated, this will reset the stored value to 0.
Properties
  • Offset - A number representing the amount added to the input value.
  • Shift Speed - A number representing the speed at which the value will change per second.
  • Logic Min - The minimum value that will output. Values below will output this value instead.
  • Logic Max - The maximum value that will output. Values above will output this value instead.
Outputs
  • Logic - A number sent and received by parts that use logic.


Smooth box.png Smooth Box

This logic box will slow down the Input variation. This helps to dampen movement, how fast the values changes.

Examples
  • Use this between a key/button and Steer on Wheel Hubs to make your ownadjustable smooth steer function.
  • It's also a great way to test out the effects of Smoothness and Speed.
  • Use this before a Wing, Engine, Rotator, etc.
  • It can also be used to create a form of delay, not just smoothing out a change in value.
Inputs
  • Logic - A number sent and received by parts that use logic.
Properties
  • Smoothness - This is the number of steps the Smooth Box will use to get from current value to the input value.
  • Shift Speed - A number representing the speed at which the value will change per second.
Outputs
  • Logic - A number sent and received by parts that use logic.


Cycle box.png Cycle Box

The Cycle box outputs a changing signal of a specified range and speed. Loop or PingPong cycle type patterns are selectable. This can be used as a clock, motor or oscillator.

Examples
  • Use this with a Rotator to make it spin (using 'From 0 / To 1' values and Loop mode).
  • Use this as a pulse for triggering Electric Switches or Transistors.
  • Can also be used as a timer.
  • With advanced usage it can also be used to store a value as well.
Inputs
  • Cycle Input - Triggers the Cycle Box to start working. The number you input is multiplied by the Cycle Speed.
  • Clear - When activated, this will reset the stored value to 0.
Properties
  • Always Cycle - Check to have it cycle continuously. This will override the input value.
  • Cycle Mode - This setting can be either Cycle or Ping-Pong. Cycle mode counts from min value up to max value and repeats starting back from the min value. Ping-Pong counts from min value up to max value, then counts back down from max to min value and repeats.
  • Shift Speed - A number representing the speed at which the value will change per second.
  • Logic Max - The maximum value that will output. Values above will output this value instead.
  • Logic Min - The minimum value that will output. Values below will output this value instead.
Outputs
  • Logic - A number sent and received by parts that use logic.


Note Box.png Note Box

This logic box generates sound using the General MIDI soundbank. You can choose the instrument and note it will play.

Examples
  • Connect a Single Output Sequence Box to the Instrument input to have the Note box play a melody.
  • Use a toggle/button on the Play input to act as a horn.
  • Use as an alarm/warning when certain values reach a certain threshold. For instance, play warning sounds if going the vehicle is going too fast.
Inputs
Instrument - A number representing which MIDI instrument will be played.
Play - An input to allow the Note Box to play. The value you input changes the volume as well. Inputs can be anywhere between 0 and 5, with 5 being the loudest.
Note - A number representing a note. The MIDI specification defines note number 60 as "Middle C", all other notes are relative.
Properties
  • Instrument - A number representing which MIDI instrument will be played.
  • Note Offset - A number defining by how many steps you want to offset the input note.
Outputs
  • MIDI - Sounds produced using MIDI instruments.


Single Output Sequence Box.png Single Output Sequencer Box

This box allows you to output a sequence at a specified interval. It can be used to automate various things in Homebrew. It can have as many Number Outputs as you need (steps), just add/delete them in the part's settings, but will always have a single actual Output value.

Examples
  • Use with Note Box to play a melody.
  • Use with a Selector Box to set the order in which you want certain things to activate (Close door, ignition on, lights on, etc..).
  • Use as a pulser to use in various logic circuits like ABS brakes.
Inputs
  • Play - Value between 0-1 that starts the sequencer. 0 being stopped and 1 the speed of the 'Time between outputs' value.
Properties
  • Always Run - When checked, this box will always be running.
  • Reset in Input - When checked, starts at the beginning of the sequence every time you start it.
  • Smooth Output - When checked, values will be smoothed between steps. From digital to analog.
  • Time between outputs - Time the sequencer plays a step before playing the next one.
  • Type - RunOnce, Loop, PingPong, and Select. Defines how the sequence is played.
  • Number Output - Value of the actual step. There's one of these for each step. When sequence is at this step, it outputs this value.
Outputs
  • Logic - A number sent and received by parts that use logic.
About the type setting
  • RunOnce causes the Single Output Sequence Box to only play through the sequence once per activation. It will need to be deactivated and reactivated in order to play again.
  • Loop causes the Single Output Sequence Box to continuously repeat the sequence on loop indefinitely, as long as the box is activated.
  • PingPong causes the box to continuously loop through the sequence indefinitely, as long as it remains active. However, when it gets to the end of a sequence, it reverses order and plays backward until it reaches the start, and then plays forward again, repeatedly.
  • Select causes the Single Output Sequencer to act like a Selector Box. The value sent to through the Play input selects which part of the sequence should be output.


If Logic Box.png If Logic Box

The If Logic Box uses If Logic to form an output based on two inputs and a conditional If Statement.The If Logic Box allows you to make conditional statements where the output is determined by whether a statement is true or false. For example if A>B then the box will output the value that is assigned to the A>B input and so on.

Examples
  • Use with a Speedometer to trigger something when speed hits a certain value.
Inputs
  • A - Input A
  • B - Input B
  • If A greater than B - The output if Input A is greater than Input B
  • If A less than B - The output if Input A is less than Input B
  • If A equal to B - The output if Input A is equal to Input B
Outputs

The value the If Logic Box outputs is determined by what values are fed into each input. If the statement is true, the box will output whatever value was tied to that input's statement. Due to how the statements are set up, only one statement can ever be true at any given time. It is possible to input the same number into multiple statements though, so it is easily possible to make the same part trigger when two of the statements are true.

Selector Box.png Selector Box

The Selector Box is a logic Box that uses an input to determine which output line will be chosen. It begins by outputting on the first logic line while the input is 0, and continues to select the line that is input+1. So if your input was 5, it would output along the 6th output.

Examples
  • Use with a Cycle/Shift Box or Single Output Selector Box in order to perform different tasks at different times.
Inputs
  • Select - Decides which output the selector uses.
Properties
  • Output Value - A number set by the player for the Logic Box to output along the selected logic line.
Outputs
  • The Selector Box can have any number of outputs, determined by how many are set in the tuner, but only one will be active at any given time.


Value box.png Value Box

The Value Box is a unique logic box. Unlike other logic boxes, it does not have any inputs. Instead, it as a number of outputs, and each output will always output an assigned number. Thus is useful when combined with other logic boxes where you'd need one input to stay constant, such as an If Logic Box.

Notes

The Value Box can have an unlimited number of outputs which can be added or deleted.

Properties
  • Output value - The value that the corresponding output will send to other logic boxes. Can be manually set for each possible output.
Outputs
  • Logic - A number sent and received by parts that use logic.


Math box.png Math Box

The Math Box contains some functions that can be very useful for complex logic systems. While it does contain 3 inputs, most of the functions only require using the first input (A) and any unused inputs can be left un-wired in the tuner.

Examples
  • todo
Inputs

Not all math functions require using all 3 inputs. The logical use of each input depends on the selected math function (see below).

  • A -
  • B -
  • C -
Properties
  • Math mode - This dropdown selects the math function that you would like to use
Math function details
Name Inputs used Description
Round A Outputs the value of A rounded to the nearest integer.
Ceiling A Outputs the value of A rounded up to the nearest integer.
Floor A Outputs the value of A rounded down to the nearest integer.
Lerp A, B, C Linearly interpolates between A and B by C.
C is clamped between 0 and 1
LerpAngle A, B, C Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
InverseLerp A, B, C Outputs the linear parameter (what would be 'C' in a normal Lerp) that produces the interpolant C within the range [A, B].
DeltaAngle A, B Outputs the shortest difference between two given angles given in degrees.
Log A, B Outputs the base B logarithm of A. If 0 is used as a base, it defaults to base 10.
Pow A, B Outputs A raised to power B.
Sqrt A Outputs the square root of A.
Mod A, B Modulus operator. Ouputs the remainder after division of A/B
Sign A Outputs the sign of A. 1 for positive, -1 for negative.
Abs A Outputs the absolute value of A
Min A, B Outputs whichever of A or B is smaller
Max A, B Outputs whichever of A or B is larger
MoveTowards A, B, C Variant of Lerp, not very useful right now
MoveTowardsAngle A, B, C Variant of Lerp, not very useful right now
Cos A Outputs the cosine of A. Takes input in degrees.
Sin A Outputs the sine of A. Takes input in degrees.
Tan A Outputs the tangent of A. Takes input in degrees.
Acos A Outputs the arc-cosine of A - the angle in degrees whose cosine is A.
Asin A Outputs the arc-sine of A - the angle in degrees whose sine is A.
Atan A Outputs the arc-tangent of A - the angle in degrees whose tangent is A.
Atan2 A, B Returns the angle in degrees whose Tan is A/B.


Outputs
  • Logic - A number sent and received by parts that use logic.


Router Box.png Router Box

The Router Box is used to forward values into a single wire. Can be used for multiplexing or otherwise applying the same formula with different logic inputs. Can also be used to easily choose between many inputs based on different modes.


Inputs
  • Index - Selects which input to replace the output (depending on properties).
  • Uses a variable number of logic inputs.
Properties
  • Mode - Can be set to Select, Least, Greatest, Closest, or Furthest.
Outputs
  • Ouput - Outputs the value of the currently selected input
  • Index - Outputs the index number of the currently selected input
Mode details
Mode Description
Select Uses the Index input to select which of the variable inputs to forward through the output.
Least Chooses the input that contains the least value and forwards it through to the output (regardless of Index).
Greatest Forwards the largest value among any of the inputs through to the output (regardless of Index).
Closest Selects whichever input contains the value closest to the Index input's value.
Furthest Finds the input with the value furthest from the value of the Index input.
Notes
  • Can use a Clock input into Index to create a Multiplexor (which can be used with a Selector Box as a Demultiplexor).
  • The output can be looped into one of the variable inputs to create a memory circuit (similar to the Memory Box).
  • Multiple Distance Sensors can be used as inputs, and can output which of the sensors has greatest/least value.


Equation Box.png Equation Box

Performs math based on defined functions and inputs to create output values. Automatically creates input and output wires for all defined input and output variables.

Usage

To use the Equation Box, simply input a properly structured equation. To do so, start by defining the output. Just select the part and go to the properties tab so you can type. Then name some kind of variable. It can be literally anything containing letters unless it's already a pre-defined variable. Once you've named your Output variable, put an equals sign ( = ). After that, you can start typing the rest of the equation by using constants and other variables. These other variables can be either inputs or outputs from elsewhere in the Equation Box. When you're done typing, press Enter to start a new line. Here you can repeat the process and create as many equations as you'd like. Variables on the left side of these equations are outputs and have an output wire associated with them. Variables to the right side of the equation sign, unless defined as outputs elsewhere in the Equation Box, are now inputs and have input wires associated with them. Once all Equations are defined in the Equation Box, deselect the Equation Box and it will automatically create the necessary inputs and outputs (I/O).

Details
Constants Description Usage Notes
pi Ratio of a circle's circumference to its diameter. Used in calculations that refer to circles and circular movement.
Infinity The number of greatest value. Any math done on it will result in itself. The exceptions are multiplying by 0 which results in NaN, multiplying by a negative number which results in negative infinity and division by zero which results in NaN. Positive infinity, negative infinity and Nan are outputted from the box as 0. Usually used to unlock upper limit on clamped values.
negativeInfinity The number of Least value. Any math done on it will result in itself. The exceptions are multiplying by 0 which results in NaN, multiplying by a negative number which results in positive infinity and division by zero which results in NaN. Positive infinity, negative infinity and NaN are outputted from the box as 0. Usually used to unlock lower limit on clamped values.
deg2rad A constant used to convert degrees to radians. By multiplying an angle value in degrees by deg2rad one can obtain this angle in radians.
rad2deg A constant used to convert radians to degrees. By multiplying an angle value in radians by rad2deg one can obtain this angle in degrees.
epsilon The smallest number in the float data type. Used for estimating if values are approximately equal.
deltatime The time it took to complete the current frame/tick. Changes value every frame. Used as a constant, mostly for timing processes in terms of seconds instead of ticks.
time The current time of day ingame. Game time. Allows your function to use the current time of day, without requiring a Time Box.
Operators Description Usage Notes
plus Adds A and B. A + B Alternatively: plus(A, B)
minus Subtracts B from A. A - B Alternatively: minus(A, B)
multiply Multiplies A by B. A * B Alternatively: multiply(A, B)
divide Divides A by B. A / B Alternatively: divide(A, B)
mod Returns the remainder of the division of A by B. Returned value will be negative if A is negative A % B Alternatively: mod(A, B)
Functions Description Notes
set(A, B) Replaces the value of A with the new value B, even if A was an input or output. A will retain this new value until something else overwrites it.
sin( x ) The ratio of the opposite leg over the hypotenuse of a right triangle with angle X across from the opposite leg. Takes input in radians.
cos( x ) The ratio of the adjacent leg over the hypotenuse of a right triangle with angle X between them. Takes input in radians.
tan( x ) The ratio of the opposite leg over the adjacent leg with the angle X across from the opposite leg. Takes input in radians.
asin( x ) Inverse Sine of X, also known as Arcsine of X. Returns the angle whose Sine = X. Output is in radians. Undefined if x < -1, or x > 1.
acos( x ) Inverse Cosine of X, also known as Arccosine of X, also known as. Returns the angle whose Cosine = X. Output is in radians. Undefined if x < -1, or x > 1.
atan( x ) Inverse Tangent of X, also known as Arctangent of X. Returns the angle whose Tangent = X Returns output in radians.
atan2( x, y ) Returns atan( x / y ) Returns output in radians.
sqrt( x ) Returns the square root of x. Undefined if x < 0
abs( x ) Returns the absolute value of a number.
min( a, b ) Returns the smallest of the numbers.
max( a, b ) Returns the largest of the numbers.
pow( x, p ) Returns the value of x to the power of p. Or, x ^ p. Using a fraction for P allows for roots. As example pow( 8, 1/3) will output 2.
exp( x ) Returns e^x, where x is the argument, and e is Euler's number (also known as Napier's constant), the base of the natural logarithms.
log( x, b ) Returns the logarithm of x with base b. Undefined if x ≤ 0
log10( x ) Returns the base 10 logarithm of x. Undefined if x ≤ 0
ceil( x ) Returns x rounded up.
floor( x ) Returns x rounded down.
round( x ) Returns x to the nearest whole number.
sign( x ) Returns -1 for negative x. Returns 1 for all other values of x.
clamp( x, low, high ) Returns x if x is between low and high. Returns low if x is smaller than low and returns high if x is bigger than high.
clamp01( x ) Returns clamped value of x between 0 and 1. Same as clamp( x, 0, 1 ).
lerp( a, b, x ) Returns interpolated value between a and b. For x equal to 0, the function returns a; for x equal to 1, it returns b; and for anything in between, it returns a mix of a and b.
lerpangle( minAngle, maxAngle, Time.time ) Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
movetowards( start, end, strength ) Variant of lerp, not very useful right now
movetowardsangle( start, end, strength ) Variant of lerpangle, not very useful right now
smoothstep( a, b, x ) Similar to the lerp function but gradually speeds up from the start and slows down toward the end.
repeat( A, B ) Same as the mod function except undefined for negative inputs.
pingpong( A, B ) If the division of A/B makes an odd number, the remainder is subtracted from B and then output. If the division is even, the remainder is directly output. Similar to the mod function.
inverselerp( start, end, input ) Outputs a value between 0 and 1 that describes where does the (input) value place itself between (start) and (end); if (input)=(start), the output will be 0, if (input)=(end), the output will be 1.
clostspoweroftwo(A) Returns the closest power of 2 to the input.
nextpoweroftwo(A) Returns the smallest power of 2 that is greater than the input.
deltaangle( A, B ) The output is the difference between the two angles A and B. It is used to prevent errors when computing angle differences.
ifbigger( A, B, true, false ) Returns (true) if A is greater than B, (false) if not.
ifequal( A, B, true, false ) Returns (true) if A and B are equal, (false) if not.
ifsmaller( A, B, true, false ) Returns (true) if A is less than B, (false) if not.
ifinrange( value, A, B, true, false ) Outputs (true) if (value) is between A and B, (false) if not.
ifoutrange( value, A, B, true, false ) Outputs (true) if (value) is NOT between A and B, (false) if it is.
Binary Logic Gates and Inequalities.
Function name Usage Notes
NOT A clamp01(1 - A)
A AND B clamp01(A * B) Can also be written as clamp01(min(A,B))
A OR B clamp01(A + B) Can also be written as clamp01(max(A,B))
A XOR B clamp01(A + B) * clamp01(1 - (A * B) )
A > B ifbigger(A, B, true, false) Returns (true) if A is greater than B, (false) if not.
A = B ifequal(A, B, true, false) Returns (true) if A and B are equal, (false) if not.
A < B ifsmaller(A, B, true, false) Returns (true) if A is less than B, (false) if not.
Tips for using binary logic
Logic wires in Homebrew use Floats, and often must be converted to binary before they can work with these expressions. To do so, simply use "clamp01(round(variable))" without the quotes, and replace "variable" with whatever variable you'd like.
To pass a variable based on the outcome of binary logic expressions, simply multiply the expression by the variable you'd like to pass. Since the expressions produce binary outputs, the variable will pass when the expression results in 1 ("true").
Recreating other logic boxes
Logic Box Equation Notes
Shift Box Shift = clamp(Shift + (deltatime * Axis * Speed), Minimum, Maximum) Speed, Minimum, and Maximum are intended to be replaced by constants, but will work as variable inputs as well.
Cycle Box Cycle = ((Cycle + (deltatime * Axis * Speed)) % Maximum) + Minimum Speed, Maximum, and Minimum are intended to be replaced by constants, but will work as variable inputs as well.
Toggle Box Toggle = repeat(Toggle + (Input * (1 - prev_input)), 2)
prev_input = Input
This contains 2 separate equations that are used together. The "prev_input" (short for previous input) equation must be below the "Toggle" equation.
Memory Box mem = (input*save) + (mem * (1-save)) Assumes save will always be either 0 or 1, otherwise add clamps and rounding as necessary.
Other useful equations
Name Equation Notes
Latch Once Latched = clamp01(Latched + LatchIn) Once turned on, it stays on. Useful for triggering something only once. Assumes the LatchIn is 0 or 1.
Signal Debouncer Output = Input * clamp01(1 - preInput)
preInput = ceil(abs(Input))
Outputs the input signal for a single frame, otherwise 0, until the input signal returns to 0.
Counter Count = Count + (Input * (1 - lastInput))
lastInput = abs(Input)
Counts up or down in integers, useful with mod function to cycle through modes. Multiply entire equation by (1-reset) to easily reset the count. Assumes Input is either -1, 0, or 1.
Countdown Timer Timer = (Timer + deltatime) * Enabled

Activate = ifbigger(Timer, TimeLimit, 1, 0)

Set TimeLimit to a number for a customized countdown timer. Assumes Enabled is either 1 or 0.
Fuel Stats maxFuel = max(maxFuel, curFuel)
FuelPercent = curFuel/maxFuel
FuelMins = (curFuel * 60)/cunsumeRate
*Outputs the current percentage of fuel, as well as how many minutes it will last at the current consumption rate.
*Works best if fuel is linked in series, remaining fuel summed, and the consumption taken from the last fuel tank in the series, the one directly drained by an engine.
*Max and Percent equations also apply to ammo and batteries.


Electrical Logic

Electric switch.png Electric Switch

This logic box allows you to use logic to turn things that use electricity On or Off. It is not a simple toggle switch, you can use any value from 0 to 1. '0' being Off (no power goes through), '1' being ON (all power goes through) and '0.5' letting half the power through.

Examples
  • Use this to turn Lights or Engines on and off.
  • Use it as a temporary extra power switch, turning it on only when needed, possibly conserving power.
  • Can be used as a visual aid to monitor certain signals, like turning a light on when a certain speed is achieved.
  • Can be used to focus the Amps from several batteries or Solar Panels.
Inputs
  • Analog Input - A number between 0 and 1. The output is multiplied by the input, but the input must be between 0 and 1.
  • Electricity - Connects engines and electrical parts to batteries and generators.
Properties
  • Analog Offset - A number between -1 and 1, including zero. Adds that number to the input.
Outputs
  • Electricity - Connects engines and electrical parts to batteries and generators.


Electric Selector.png Electric Selector

Functions almost exactly like the Selector Box, except it uses electric outputs instead of logic, making it super easy to select one of many things to receive power.

Inputs
  • Electricity - Connects engines and electrical parts to batteries and generators.
  • Select - Decides which output the selector uses.
Outputs
  • The Electric Selector Box can have any number of outputs, determined by how many are set in the tuner, but only one will be active at any given time.


Sensors

Speedometre.png Speedometer

Outputs the speed the vehicle is moving at, in whatever units you'd like. It can be placed anywhere. Position doesn't matter unless placed after a hinge or detacher (not a servo). In which case, the speedometer will report the velocity of that sub-vehicle. Orientation of the speedometer does not matter for the Speed output, but all other outputs are relative to the Speedometer's orientation.

Examples
  • Use with a Display to see what speed you are driving at.
  • Use to move parts once a certain speed is attained, like extend/retract wings.
  • Use to limit speed by cutting the throttle at a specified speed.
Properties
  • Speed System - Velocity in KilometresPerHour, MilesPerHour, MetresPerSecond or Knots.
Notes
  • Sideways, Vertical, and Forward outputs are all relative to the Speedometer Box's orientation.
Outputs
  • Speed - Outputs the overall speed of the vehicle across all axes. Uses the units chosen in properties.
  • Sideways Speed - Outputs the sideways velocity of the vehicle. Left being negative, right being positive.
  • Vertical Speed - Outputs the speed at which the vehicle is moving across vertically. Down for negative, up for positive.
  • Forward Speed - Outputs the how fast the vehicle is going forward or backward. Backwards is negative, forwards is positive.


Gyrometre.png Gyrometer Box

The Gyrometer Box outputs information about the vehicle's attitude along the Pitch, Yaw, and Roll axes respectively. It will output 2 sets (angle/angular velocity) of 3 values (pitch, yaw, roll) along with a up/down state depending on whether your vehicle is upside down or not. Further information about these axes.

The 3 angle outputs give you the angle (static), on 3 different planes, at which you are pointing at in the 3D world. The angular velocity outputs tell you how fast (force) you are spinning around the yaw, pitch and roll axis.

Examples
  • Use with a Rotational Gyrometer to stabilize a vehicle.
  • Use angular velocity outputs to damping a spinning vehicle.
  • Use to flip a vehicle back on their wheels when 'upside down'.
  • Use the pitch and Roll outputs to create a "level" to determine how level a surface is with the world.
Properties
  • Output Type - The type of units used to measure an angle. Uses degrees and Vector.
  • Value When Up - A custom value for the Gyrometer to output when it is oriented with the words facing upward.
  • Value When Down - A custom value for the Gyrometer to output when it becomes upside-down, AKA has the words facing downward.
Outputs
  • Pitch - The current Pitch of the vehicle. AKA, how much the vehicle is pointing up or down.
  • Yaw - The current Yaw of the vehicle. AKA, how much the vehicle is pointing sideways left or right, relative to North.
  • Roll - The current Roll of the vehicle. AKA, how much the vehicle is twisted clockwise/counter-clockwise.
  • Pitch Velocity - Outputs how fast the vehicle is rotating along the Pitch axis.
  • Yaw Velocity - Outputs how fast the vehicle is rotating along the Yaw axis.
  • Roll Velocity - Outputs how fast the vehicle is rotating along the Roll axis.
  • Up/Down - Uses the up/down value settings. When the box is face up, it uses the setting corresponding to up, and similar when facing down.
Notes
  • The velocity outputs use Radians per second as their units.


Distance sensor.png Distance Sensor Box

The Distance Sensor will output the distance it is from a world surface. A Distance Sensor aimed at the ground outputs it's distance from the ground, not to be confused with an altimeter which would output height relative to sea level.

Examples
  • Use as a ground distance indicator on any aircraft.
  • Use to make autonomous vehicles that can avoid obstacles.
  • Use to deploy/retract landing gear at a specific ground distance.
Properties
  • Distance Type - The type of units the logic box will output for distance.
Outputs
  • Logic - A number sent and received by parts that use logic.


Time Box.png Time Box

The Time box outputs the world time in either of 2 formats. This is the same time that you can adjust in the settings.

Examples
  • Use to turn on Lights at a specific time.
  • Use with other logic boxes to determine time between two data-points.
  • Use with a rotator to make a big clock.
Properties
  • Time Display Type - Can be either Factor or Hours. Factor displays time of day as 0 at midnight ad 1 just before midnight. Hours displays time of day as HH.mmss. Meaning it displays two digits as hours, the first two decimal places as minutes, and the and fourth decimal places represent seconds.
Outputs
  • Time - Current time of the world the sensor is spawned in.
  • Day or Night - Outputs a 1 if it is day, and a 0 if it is night.


GPS box.png GPS Box

The GPS Box outputs its position on the world's x,y,z. GPS units are in meters.

Examples
  • Use with several displays, a pencil, and paper to easily remember your favorite locations.
  • Use with Memory Boxes to store a coordinates for a Navigator Box.
  • Use with radios to transmit coordinates to over vehicles.
Outputs
  • X Coordinate - A position in the world of Homebrew along the X axis. Used as one of three dimensions to determine the location of something in the world of Homebrew.
  • Y Coordinate - A position in the world of Homebrew along the Y axis. Used as one of three dimensions to determine the location of something in the world of Homebrew.
  • Z Coordinate - A position in the world of Homebrew along the Z axis. Used as one of three dimensions to determine the location of something in the world of Homebrew.


Navigator box.png Navigator Box

The Navigator box will output a heading (direction) and distance to coordinates you enter. Tell it where you want to go, and it will show you both how far away it is, and which way to turn in order to face the direction you need to fly to get there.

Inputs
  • X Coordinate - A position in the world of Homebrew along the X axis. Used as one of three dimensions to determine the location of something in the world of Homebrew.
  • Z Coordinate - A position in the world of Homebrew along the Z axis. Used as one of three dimensions to determine the location of something in the world of Homebrew.
Properties
  • Don't use Wires? - When checked, this setting causes the Navigator Box to use internal coordinate settings, instead of using the inputs.
  • X Coordinate - A position in the world of Homebrew along the X axis. Used as one of three dimensions to determine the location of something in the world of Homebrew.
  • Z Coordinate - A position in the world of Homebrew along the Z axis. Used as one of three dimensions to determine the location of something in the world of Homebrew.
  • Degrees/Vector - Toggle between Degrees or Vector output for the Heading.
  • Distance Type - Choose the type of distance as output (KM, M, CM, Miles, etc)
Outputs
  • Distance - The distance between the navigator box and the input coordinates.
  • Heading - The vector/degrees from the direction the Navigator Box is facing, to the input coordinates.


Displays

Number display.png Number Display

A screen to display values connected to it's input. Useful for displaying information about the vehicle you're in. Such as current speed, altitude, selected gear, etc.

Inputs
  • Logic - A number sent and received by parts that use logic.
Properties
  • Decimal Offset - Moves the decimal point of the input by this many places. Positive values move right, negative move left.
  • Additional Text - Allows you to write text to be displayed.
Outputs
  • Display - Output will be displayed on part.


Pixel Display.png Pixel Display

Just as screens have pixels, so does Homebrew. The Pixel Display is a small cube where one side lights up as a single solid color, based on either properties or inputs, forming a pixel. It can be used in all sorts of ways, but primarily functions as an indicator, to be used when you want something smaller than a Number Display but don't need to show exact numbers. These indicators shine perfectly, day or night, rain or fog, even underwater, behind a smokescreen, or with a light shining on them.

Inputs
  • Intensity - This value affects the brightness of the pixel. Uses values between 0 and 1.
  • R - A number between 0 and 1 that determines how strong the red component of the color is.
  • G - A number between 0 and 1 that determines how strong the green component of the color is.
  • B - A number between 0 and 1 that determines how strong the blue component of the color is.
Properties
  • Dynamic - Check this to make the pixel accept inputs. If unchecked, it will use its internal properties instead.
  • R - A number between 0 and 1 that determines how strong the red component of the color is.
  • G - A number between 0 and 1 that determines how strong the green component of the color is.
  • B - A number between 0 and 1 that determines how strong the blue component of the color is.
Outputs
  • Light - An ambient effect that increases the brightness of nearby objects. In some cases it can even be colored.