Hey Everyone,
Extremely excited to be posting this info tonight and I know a couple of you have been looking forward to this update. I apologize about the delay but it’s been hard to find the time while working on my new game since I am dealing with time constraints but I finished knocking these out and spent the past two days getting these ready for the community. I planned to launch a YouTube channel by now and would highlight these in the first couple vids but it’s going to get pushed back a little longer. But in the meantime, here they are and a tutorial for each to get you started. They are all nearly complete and should be perfectly stable if you end up using them. I am going to keep this all localized within a single post and I am looking forward to seeing what everyone thinks about these new plugins and also the feedback on what to do for the final version of each.
NOTE: To install these all I believe you will do is unzip these within the Plugins folder of your UE4 install and you should be all good. Also, these plugins were developed in UE4.2 and may not work in a different version of the engine. I will keep you all posted on future versions of these plugins and let me know if you run into any issues. Also, I posted images with this post from my OneDrive account, let me know if you have problems seeing them. One other thing is I posted the new enumerations that these plugins bring and I had started dev on these at different points and haven’t gone through and updated all the prefixes and metadata aside from the Easing Functions plugin since that was the most recent so please ignore if one starts with ‘U’ and another has ‘E’. If you end up reliant on the enum type names, shoot me an update and I’ll prioritize things to go through and standardize them for the Saitek and Joystick plugins to match the standard that Epic uses for all their enum type names, otherwise it will probably be in my next update to both plugins. It simply came down to a matter of time to get these out so you guys could try them out.
Take Care And Enjoy
-Matt
New UE4.2 Plugin – Joystick Input
Download: Joystick Input Plugin - BETA 0.9.6
At the moment, this feature is supported through a plugin and cannot be mapped through the Input Properties as it would require modifying the Engine code (Maybe in the future). It is setup by binding Custom Events to Event Dispatchers to get data such as if a given Axis changes or a button is pressed. All of this functionality is provided by the new ‘JoystickState’ UClass.
It’s recommended but not required to create a Blueprint that is based off of ‘JoystickState’. This way you can add functionality to the Blueprint if needed but whenever running the game either in ‘Play’ or ‘Simulate’, you can open up the Defaults Tab under your custom ‘JoystickState’ Blueprint and see the values that come back from the different Axis or buttons. It’s more for debugging purposes if you want a quick way to visualize what data is coming back from your Joystick or H.O.T.A.S Flight System.
VERSION NOTE: Currently, only one Joystick can be accessed at a given time. This will likely be changed when I release the final version. Also, you cannot connect/disconnect your Joystick while the game is running, it must be from the start. I am assuming there is an interface I could inherit that would notify my class of device changes but I haven’t had the time to investigate that. If someone knows the answer, let me know.
Here is an example of how to interface with a custom ‘JoystickState’ Blueprint…
We start by creating a Blueprint node (‘Create Joystick State’) that can create an instance of that state whether it’s the base ‘JoystickState’ or your custom one…
From there, we simply create some custom events that we bind to the Event Dispatchers we care about coming from the ‘JoystickState’.
Here are a list of the delegates you need to map to as Custom Events. You can create your own name but make sure to map the parameters to the same type.
FJoystickStateAxisChangedSignature(JoystickAxisType Type, JoystickAxis Axis, float Value)
FJoystickStateSliderChangedSignature(JoystickSliderType Type, JoystickAxis Axis, float Value)
FJoystickStatePOVChangedSignature(uint8 Index, int32 Degrees, bool IsNeutral)
FJoystickStatePOVButtonPressedSignature(uint8 Index, JoystickPOVButton Button)
FJoystickStatePOVButtonReleasedSignature(uint8 Index, JoystickPOVButton Button)
FJoystickStateButtonPressedSignature(uint8 ButtonIndex)
FJoystickStateButtonReleasedSignature(uint8 ButtonIndex)
New UEnums:
UENUM(BlueprintType, Category = "Joystick State|Enumerations")
enum JoystickAxis
{
XAxis = 0,
YAxis = 1,
ZAxis = 2,
UAxis = 3,
VAxis = 4
};
UENUM(BlueprintType, Category = "Joystick State|Enumerations")
enum JoystickAxisType
{
Position = 0,
Rotation = 1,
Velocity = 2,
AngularVelocity = 3,
Acceleration = 4,
AngularAcceleration = 5,
Force = 6,
Torque = 7
};
UENUM(BlueprintType, Category = "Joystick State|Enumerations")
enum JoystickSliderType
{
SliderPosition = 0,
SliderVelocity = 1,
SliderAcceleration = 2,
SliderForce = 3
};
UENUM(BlueprintType, Category = "Joystick State|Enumerations")
enum JoystickPOVButton
{
POV_Unknown = 0,
POV_Neutral = 1,
POV_Top = 2,
POV_TopRight = 3,
POV_Right = 4,
POV_DownRight = 5,
POV_Down = 6,
POV_DownLeft = 7,
POV_Left = 8,
POV_TopLeft = 9
};
I believe that this object may get destroyed by the GC since it uses the UClass attribute and derives from UObject but just in case you need to manually dispose of the state, here is how you would do that…
New UE4.2 Plugin – Blueprint Easing Functions
Download: Easing Functions Plugin - BETA 0.9.9
You can now utilize Easing Functions within Blueprints to give you more options for handling interpolation. The currently supported functions are the following: Linear, Quadratic, Cubic, Quartic, Quintic, Sinusoidal, Exponential and Circular. I was going to remove Linear since Lerp exists but just in case you want to be able to easily switch back and forth between the different functions, it made sense to keep it in. You can find these options in the Blueprints menu under Math → Easing Functions.
There are two kinds of easing function you can make a call to, one that takes a starting point and a delta…
…and one that interpolates between a start point and end point over a given easing curve using an Alpha value that ranges from 0 – 1 like the traditional Lerp.
Easing functions also have 3 options for the path of the curve: In, Out, In/Out.
New UEnums:
UENUM(BlueprintType, Category = "Math|Easing Functions")
enum EEasingFunctionType
{
EEasingFunction_Linear = 0 UMETA(DisplayName = "Linear"),
EEasingFunction_Quadratic = 1 UMETA(DisplayName = "Quadratic"),
EEasingFunction_Cubic = 2 UMETA(DisplayName = "Cubic"),
EEasingFunction_Quartic = 3 UMETA(DisplayName = "Quartic"),
EEasingFunction_Quintic = 4 UMETA(DisplayName = "Quintic"),
EEasingFunction_Sinusoidal = 5 UMETA(DisplayName = "Sinusoidal"),
EEasingFunction_Exponential = 6 UMETA(DisplayName = "Exponential"),
EEasingFunction_Circular = 7 UMETA(DisplayName = "Circular")
};
UENUM(BlueprintType, Category = "Math|Easing Functions")
enum EEasingFunctionPath
{
EEasingFunctionPath_In = 0 UMETA(DisplayName = "In"),
EEasingFunctionPath_Out = 1 UMETA(DisplayName = "Out"),
EEasingFunctionPath_In_Out = 2 UMETA(DisplayName = "In + Out")
};
New UE4.2 Plugin – Saitek X52 Pro
Download: Saitek X52 Pro Plugin - BETA 0.9.8
For anyone out there with the Saitek X52 Pro H.O.T.A.S Flight System, you now have the ability to control the LED’s on the device as well as sending text to the MFD on the throttle.
Here is the Saitek X52 Pro…
Here are the options under Blueprints…
And here is a tutorial on how we would setup the device and shut it down when the running instance has ended…
The device works off of a page system. We need to first initialize the device with our ‘App Name’ and then add a page. Each ‘page’ of settings is stored in memory on the device. In the current version, there isn’t any functionality to switch the Active Page so only worry about creating one and make sure you check the box ‘Make Active’ if you don’t, you won’t see your calls make it to the device.
The next step is to call to change the LEDs on the device before setting the text on the MFD. The Saitek X52 Pro doesn’t have multi-color LEDs and instead has a Red and Green one side by side under each button. To get either Red, Green or Amber, you need to turn on or off the appropriate Red or Green LED. Red and Green both on = Amber. Also, when you write text to the display (MFD), you have the option of writing it to either the top, middle or bottom lines.
And, after we run the app, the light turns amber for a second (since my green led is already lit), then back to green. And then the MFD prints this out…
New UEnums:
/**
* This enumeration is responsible for representing the different LED states that are possible on the Saitek X52 Pro.
*/
UENUM(Blueprintable, Category = "SaitekX52Pro|Enumerations")
enum USaitekX52LEDID
{
/*
* Values: 0 (off) or 1 (on) Fire button illumination on/off (color is controlled by the position of the safety cover)
*/
SafeFire = 0,
/**
* 0 (off)or 1 (on)Fire A - red component
*/
FireA_Red = 1,
/**
* 0 (off) or 1 (on) Fire A - green component
*/
FireA_Green = 2,
/**
* 0 (off) or 1 (on) Fire B - red component
*/
FireB_Red = 3,
/**
* 0 (off) or 1 (on) Fire B - green component
*/
FireB_Green = 4,
/**
* 0 (off) or 1 (on) Fire D - red component
*/
FireD_Red = 5,
/**
* 0 (off) or 1 (on) Fire D - green component
*/
FireD_Green = 6,
/**
* 0 (off) or 1 (on) Fire E - red component
*/
FireE_Red = 7,
/**
* 0 (off) or 1 (on) Fire E - green component
*/
FireE_Green = 8,
/**
* 0 (off) or 1 (on) Toggle 1/2 - red component
*/
Toggle12_Red = 9,
/**
* 0 (off) or 1 (on) Toggle 1/2 - green component
*/
Toggle12_Green = 10,
/**
* 0 (off) or 1 (on) Toggle 3/4 - red component
*/
Toggle34_Red = 11,
/**
* 0 (off) or 1 (on) Toggle 3/4 - green component
*/
Toggle34_Green = 12,
/**
* 0 (off) or 1 (on) Toggle 5/6 - red component
*/
Toggle56_Red = 13,
/**
* 0 (off) or 1 (on) Toggle 5/6 - green component
*/
Toggle56_Green = 14,
/**
* 0 (off) or 1 (on) POV 2 - red component
*/
POV2_Red = 15,
/**
* 0 (off) or 1 (on) POV 2 - green component
*/
POV2_Green = 16,
/**
* 0 (off) or 1 (on) Clutch (i) - red component
*/
Clutch_Red = 17,
/**
* 0 (off) or 1 (on) Clutch (i) - green component
*/
Clutch_Green = 18,
/**
* 0 (off) or 1 (on) Throttle axis illumination on/off (color is controlled by the throttle position)
*/
ThrottleAxis = 19
};
/**
* This enumeration is responsible for representing the different text locations that are possible on the Saitek X52 Pro MFD.
*/
UENUM(Blueprintable, Category = "SaitekX52Pro|Enumerations")
enum USaitekX52StringID
{
/**
* 16 characters before display scrolls Top line on MFD
*/
Top_Line = 0,
/**
* 16 characters before display scrolls Middle line on MFD
*/
Middle_Line = 1,
/**
* 16 characters before display scrolls Bottom line on MFD
*/
Bottom_Line = 2,
};