-
I’m calculating cubic meters from studs, 1 metre is exactly 3.5714285714285714286 studs (but I round this down to 3.57 so it should in actuality be around 0.998800479936 studs since we have 0.9996 meters on each side of the cube)
-
When I ask the “assistant” AI to spit out a script for calculating total volume it gives a script example.
-- Assume we have a model with parts, and we want to calculate the internal volume
local model = script.Parent
local cubicVolume = 0
-- Conversion factor from studs to meters
local studToMeter = 0.28
-- Iterate through each part in the model
for _, part in pairs(model:GetDescendants()) do
-- Check if the object is a part
if part:IsA("BasePart") then
-- Calculate the volume of the part in studs
local partVolumeStuds = part.Size.X * part.Size.Y * part.Size.Z
-- Convert the volume to cubic meters
local partVolumeMeters = partVolumeStuds * studToMeter^3
cubicVolume = cubicVolume + partVolumeMeters
end
end
-- Print the total internal volume in cubic meters
print(cubicVolume)
- The assistant AI tried redefining the conversion factor like this, but this led to another inconsistent result (35 instead of 32)
local partVolumeMeters = partVolumeStuds * studToMeter^3
to
local partVolumeMeters = partVolumeStuds * conversionFactor
where conversionFactor is defined as
local conversionFactor = studToMeter^3
Why are these values so far off of the intended ~0.9988 meters I get from hand calculating?