coder_for_life22 Posted July 13, 2018 Share Posted July 13, 2018 I am currently trying to drag a sprite on the screen when the screen is dragged but I do not want the sprite to snap to the users thumb. I've tried using OnDrag for the sprite itself but this requires the sprite to be touched and dragged. I've also tried using the input managers x and y to move the sprite but this makes the sprite snap to wherever the use places their finger and then the drag happens. I would like the sprite to be dragged from its currently position but not snap to the users finger. So it the user touches the screen and drags the sprite drags too but only from where it is and not snapping to the location of the users finger. Does anyone know how I can achieve this? Link to comment Share on other sites More sharing options...
NoxBrutalis Posted July 13, 2018 Share Posted July 13, 2018 couldn't you work out the distance between the sprite and the click event and use that as an offset when dragging? Sorry I don't have any code but that's what I would try to do. Link to comment Share on other sites More sharing options...
coder_for_life22 Posted July 13, 2018 Author Share Posted July 13, 2018 Yup. I just implemented a solution a few minutes ago! I first set a boolean when the screen is pressed and then set it to false when the pointerup is triggered. In the update() I check the boolean and if its true that means we are dragging or the finger is down. I then just get the delta from the mouse movement. So the distance between the old mouse pos and the new mouse pos I then add this to the sprite to get it to work perfected. In case anyone asks this in the future. NoxBrutalis 1 Link to comment Share on other sites More sharing options...
coder_for_life22 Posted July 14, 2018 Author Share Posted July 14, 2018 Does anyone know how I can increase the sensitivity of this? Link to comment Share on other sites More sharing options...
coder_for_life22 Posted July 14, 2018 Author Share Posted July 14, 2018 Making the touches/drags more sensitive and faster Link to comment Share on other sites More sharing options...
Recommended Posts