I have been beating my head against the wall with this one. I am trying to create a mod part with multiple input axis and I can not figure out how to reference more than one. Any help would be great.
I have been beating my head against the wall with this one. I am trying to create a mod part with multiple input axis and I can not figure out how to reference more than one. Any help would be great.
I actually had the exact same issue as you!
Example code:
Right after the behavior class start:
// Array of input controllers.
Jundroo.SimplePlanes.ModTools.Parts.IInputController[] inputs = new Jundroo.SimplePlanes.ModTools.Parts.IInputController[3];
float input_scaleX;
float input_scaleY;
float input_scaleZ;
In the start void:
inputs = this.GetComponentsInChildren<Jundroo.SimplePlanes.ModTools.Parts.IInputController>();
And then just do
this._scaleX = inputs[0].Value;
Hopefully you can understand how it works and can apply it to your own code.
@ArmouredTrashCan good to hear
@PlaneFlightX I got it sorted. Thank you
Update, just looked at my code and in the earlier example I sent, I define variables and then set different ones. This new comment fixes that. I also made all the characters show up correctly (for example this:
"<"
doesn't turn into this:
"<"
)
Right after the behavior class start:
Jundroo.SimplePlanes.ModTools.Parts.IInputController[] inputs = new Jundroo.SimplePlanes.ModTools.Parts.IInputController[3];
private float _scaleX = 0;
private float _scaleY = 0;
private float _scaleZ = 0;
In the start void:
inputs = this.GetComponentsInChildren<Jundroo.SimplePlanes.ModTools.Parts.IInputController>();
In the update void, wherever you please:
this._scaleX = inputs[0].Value;
this._scaleY = inputs[1].Value;
this._scaleZ = inputs[2].Value;
And obviously you can take the basic syntax structure and change it as you need. This code is for three input controllers.
Also, if you're wondering what stuff like
private
is, they are keywords in C# but they don't seem to be required for the purpose of scripting part behavior. Some of my variables have them, some don't. My code is also a mix of random stuff I got from other mods and the internet, but it works.@ArmouredTrashCan oh, < is <, same with > and >
It's just how code blocks format it.
@PlaneFlightX I am getting an error with < Do I need a library or something to get that phrase to work
That looks like it'll work