Virtual Joystick Controls (Unity Source Code) - movement & rotation-simple input multi touch system Description
Test this asset with this link (WebGl)
Note: It can be used in 2D games as well as 3D. An example of a 2D project created using this asset: https: //www.youtube.com/watch? v = T7AbSXMgMWk
Requires Unity 2017.4.1 or later. Compatible with Android and iOS.
I am always looking to improve my assets. Feel free to contact us if you need the features you need in the new version or have suggestions on how to improve this asset.
This asset provides a move + rotate joystick control that is very easy to set up and use.
How to use it?
-Drag and drop "joystick.prefab" from the "Prefab" folder into your scene.
-In the script use the "JoystickLeft.positionX" static variable to get the X-axis value of the left joystick and "JoystickLeft.positionY" to get the Y-axis value (from -1 for x) Get values up to 1 and from -1 to 1) for the y-axis).
-Use "JoystickRight.angle" to get the correct rotation value for the joystick. If you want to get the rotation in degrees instead of radians, call "Mathf.Rad2Deg * JoystickRight.angle".
You can select the joystick to use for movement (left or right) and the joystick to use for rotation. Or, you can only use one joystick to move and rotate.
If the Sticky option is checked, the joystick will be hidden and will appear where you touch the screen. If this option is off, the joystick will always stay in the same position.
The Stick Movement Threshold determines how much the joystick can move from the center position.
If "Drag joystick base" is checked, the joystick base will move when the finger or pointer is dragged outside the movement of the joystick.
The Freeze X option freezes the X-axis.
The Freeze Y option freezes the Y axis.
Virtual Joystick Controls (Unity Source Code) - movement & rotation-simple input multi touch system