Quantcast
Channel: Answers by "IvovdMarel"
Viewing all articles
Browse latest Browse all 145

Answer by IvovdMarel

$
0
0
Rather than continuously checking wether or not you are touching the object, you should set a boolean to true, similar to this: if (Input.GetMouseButtonDown(0)) { if(Physics.Raycast(ray, Mathf.Infinity, playerLayerMask)) { dragging = true; } } and then set dragging to false when you release the mouse. (Input.GetMouseButtonUp(0)) While dragging, have the object follow your mouse as you did in your code. Note - in case you're wondering, this also works for mobile touch.

Viewing all articles
Browse latest Browse all 145

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>