- Home /
Crossplatform Joystick cicular movement instead of square?
I'm using the CrossplatformInput Standard Assets plugin, and I noticed that the movement of joystick is actually square. What I want and most mobile games use are circular joystick. (The joystick button should always stay within the circle, while at 45deg). So the magnitude at 45deg is always 1, while the direction vector is (1/sqrt(2), 1/sqrt(2)).
Is there any easy way to do it?
Currently: Good at 0-90-180 deg Bad at 45-135 deg
Answer by SweatyChair · Mar 02, 2018 at 06:28 AM
I just hacked a acceptable solution, for anyone like me who has already implemented CrossPlatformInput but don't wanna use something else for that:
Add into line91 in StandardAssets/CrossPlatformInput/Scripts/Joystick.cs:
// Hack: always have max magnitude equal to MovementRange only
newPos = Vector3.ClampMagnitude(newPos, MovementRange);
Answer by Beks_Omega · Mar 01, 2018 at 01:15 AM
This seems to have the functionality you're looking for: https://www.youtube.com/watch?v=uSnZuBhOA2U&t=395s
Your answer
Follow this Question
Related Questions
How to get input from wheel(car direction) joystick? 1 Answer
Is there a way to create a floating JoyStick using the On-Screen Stick component? 0 Answers
Multiple joystick input 2 Answers
How do I change this code so that i can press on the joystick more than once to shoot? 1 Answer
Using the Volume Control Buttons On Mobile Devices 0 Answers