skate1011
|
  |
| Joined: 13 Mar 2010 |
| Total Posts: 688 |
|
|
| 23 May 2012 08:37 PM |
What I want to do is is use math.ceil() or math.floor() with a Position or CFrame -Skate1011 |
|
|
| Report Abuse |
|
|
|
| 23 May 2012 08:49 PM |
floor, ceiling
print(math.floor(0.5)) > 0
print(math.ceil(0.5)) > 1 |
|
|
| Report Abuse |
|
|
skate1011
|
  |
| Joined: 13 Mar 2010 |
| Total Posts: 688 |
|
|
| 23 May 2012 08:51 PM |
No, I want to use it with a Position or a CFrame value like (1.4, 4.2, 5.2)
-Skate1011 |
|
|
| Report Abuse |
|
|
|
| 23 May 2012 08:52 PM |
You'd have to floor each of the components of the Vector3/CFrame.
local function floor(vector) return Vector3.new(math.floor(vector.X), math.floor(vector.Y), math.floor(vector.Z)) end
Haters gonn' hate. |
|
|
| Report Abuse |
|
|
|
| 23 May 2012 08:53 PM |
If you're asking that because of your thread, then forget it.
Just do what I suggest, use the Symmetrical FormFactor. It rounds stuff automatically. |
|
|
| Report Abuse |
|
|
|
| 23 May 2012 08:54 PM |
function floorCFrame(cfv) return CFrame.new(math.floor(cfv.x),math.floor(cfv.y),math.floor(cfv.z)) end
function ceilCFrame(cfv) return CFrame.new(math.ceil(cfv.x),math.ceil(cfv.y),math.ceil(cfv.z)) end
Part.CFrame = floorCFrame(1.5,2.5,3.5) > 1,2,3 |
|
|
| Report Abuse |
|
|
|
| 23 May 2012 08:54 PM |
Hey, people, do me a favor and stop using math.floor and math.ceil everywhere for no reason.
There's a % operator. Use it.
n = n - n % 1
That'll remove the decimal part of n. |
|
|
| Report Abuse |
|
|