3 by 1 grid with mathf.round and ScreenToWorldPoint
Hello! I want to make a game where I place platforms, and then the automatic runner jumps onto it, but my problem is that my platforms are 3 by 1 and not 1 by 1. Then the Mathf.round won't work because it's only rounding to 1, 2, 3 etc. But my x coordinates need to be 0, 3, 6 etc. If there's a way to do that please tell me!
Answer by DawdleDev · Apr 30, 2018 at 07:42 PM
Let's say the input x coordinates are represented by inX. The way to do this would be:
xPosition = 3 * Mathf.Round(inX/3);
This way, it rounds it only to multiples of three, as you requested. Hope this helps!
Thanks for that! I tried $$anonymous$$athf.Round(int) / 3, so I understand my fail now. Thanks!
Your answer
Follow this Question
Related Questions
C# Mathf.Round Not Rounding Input.mouseposition 0 Answers
Unit Circle Coordinates 0 Answers
Save object position after drag? 0 Answers
How to know How many times the number was multiplied? 2 Answers
Mathf.Clamp does not work at all. 1 Answer