Skip to content

Commit

Permalink
Bugfix for dynamic joystick on canvases that are not Screen Space (Ov…
Browse files Browse the repository at this point in the history
…erlay)
  • Loading branch information
yasirkula committed Jan 31, 2019
1 parent 9dbdacd commit 52a02e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Plugins/SimpleInput/Scripts/AxisInputs/Joystick.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ public void OnPointerDown( PointerEventData eventData )
if( isDynamicJoystick )
{
pointerInitialPos = Vector2.zero;
joystickTR.position = eventData.position;

Vector3 joystickPos;
RectTransformUtility.ScreenPointToWorldPointInRectangle( dynamicJoystickMovementArea, eventData.position, eventData.pressEventCamera, out joystickPos );
joystickTR.position = joystickPos;

}
else
RectTransformUtility.ScreenPointToLocalPointInRectangle( joystickTR, eventData.position, eventData.pressEventCamera, out pointerInitialPos );
Expand Down
Binary file modified SimpleInput.unitypackage
Binary file not shown.

0 comments on commit 52a02e8

Please sign in to comment.