oseday
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 1308 |
|
|
| 05 Feb 2014 08:42 PM |
for _,prts in ipairs(dot_storage:GetChildren()) do if (intdot.Value).p+Vector3.new(0,0,-dist) == (prts.Value).p or (intdot.Value).p+Vector3.new(-dist,0,0) == (prts.Value).p then link(intdot,prts) end end
intdot and prts are CFrameValue Objects.
Simple thing right? Think again. In some cases playing with smaller numbers, it return 55.999999 or 56.00052 (Examples) where it should return 56.000000. This makes my script not to function properly. Any ideas how to fix? |
|
|
| Report Abuse |
|
|
|
| 05 Feb 2014 08:48 PM |
| Isn't there some kind of math function to round to the nearest integer? I know math.floor() rounds down to the nearest integer, but there should be one that rounds to the nearest integer. |
|
|
| Report Abuse |
|
|
dodleman
|
  |
| Joined: 22 Dec 2007 |
| Total Posts: 1118 |
|
| |
|
As8D
|
  |
| Joined: 24 Dec 2009 |
| Total Posts: 2907 |
|
|
| 06 Feb 2014 06:27 AM |
Try this:
function round(n) return math.floor(n * 1000 + 0.5) / 1000 end
floatssssss... and why did I enter this forum again? Not that I've got anything against it. - As, ohno, not 2 lines! also, cheap answer ): |
|
|
| Report Abuse |
|
|
oseday
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 1308 |
|
|
| 06 Feb 2014 06:44 AM |
| Well, that rounding works to a point, thanks anyway. Let this thread die. |
|
|
| Report Abuse |
|
|