Propeller Thrust Expression 2 Code!

While helping another user with his issues with the propeller tool, I mentioned that to my knowledge it was better to use an expression2 chip to apply force in the same direction that the propeller tool would. I didn’t know how the propeller tool calculated the force for a given rotation speed, but I got curious. After about 2 hours of snooping around LUA files and playing the trial and error game, I was able to come up with an expression2 code that works very much like the propeller tool. The code and details are below:

@name Propeller AppForce
@persist Yawvel Thrust:vector PowerLog Boundrad X Y Z Efficiency RPM
@model models/propellers/propeller3x.mdl


Efficiency=10 #Same effect as in the propeller tool

Boundrad=sqrt(X^2+Y^2+Z^2) #Attempting to calculate bounding radius





This E2 is a good deal more powerful than the propeller tool for a given Efficiency, so don’t set it super high.
This E2 IS the propeller. It isn’t a chip you put somewhere else on your contraption, it is the physical propeller itself. Change the model path in the @model header to change the model of the propeller. (As it is above, it is set as Gigabyte’s 3 bladed propeller from his model pack.)
The propeller works equally well and with equal force in both directions. As it is now, the E2 applies forward force for counterclockwise rotation, and backwards force for clockwise rotation.
This expression WILL WORK AT ANY SPEED. It does not suffer from the RPM cutoff that the propeller tool does.

Most of the credit here should go to Out$ider, the creator of the original Propeller tool. About 90% of this code is his that I just dissected, updated, and translated to work for Expression2.