Open NickRyge opened 1 year ago
The solution for this is in the line:
if val == nil or not prop.pid then return end
this boils down to the fact that if the electricsvalue of the function that is requested doesn't actually exist, then it'll just return. Always.
So the solution really is simple: Leave the desired electricsvalue nil, and then create a placeholder electricsvalue that can be used to overwrite the prop electrics value when manipulated.
The lua code for updating props takes into account the function value, which is taken from the jbeam, and then multiplies that by whatever the electrics value is.
This has the benefit of being extremely easy to implement, but has the downside that a prop can be rotated along only one axis. This axis can be anything though.
using the updateprop function, the prop can also be moved, leading to far more control over what actually happens rather than accepting movement along only a single axis.
This leads me to believe a solution of the following is possible:
Instead of setting a fixed multtiplier (That determines axis) in the jbeam and then moving along that axis using the electrics value - A fixed electrics value is proposed and then simply scaling the prop movement by changing the axiis multiplier. This allows for rotation in all directions, while also allowing relatively precise control.
The only problem is that props rotate around arbitrary points created when spawning the prop, as the prop exists as a location between 3 vectors. Since these vectors are never entirely straight, it can cause problems