generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Surface area.

Previous Thread :: Next Thread 
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
06 Apr 2013 02:07 AM
So I was making a script to print the surface area of a part, wedge part, or corner wedge part...

I can't seem to find a way to find the surface area of a corner wedge part. This is what I have, but don't know where to start with the corner wedge


if script.Parent.ClassName == "Part" or script.Parent.ClassName == "TrussPart" then
SurfaceX = script.Parent.Size.X * script.Parent.Size.Y * 2
SurfaceY = script.Parent.Size.X * script.Parent.Size.Z * 2
SurfaceZ = script.Parent.Size.Z * script.Parent.Size.Y * 2
TotalSurfaceArea = SurfaceX + SurfaceY + SurfaceZ
if script.Parent.ClassName == "Part" then
print("The Surface area of this part is " ..TotalSurfaceArea)
else
print("The Surface area of this truss is " ..TotalSurfaceArea)
end
elseif script.Parent.ClassName == "WedgePart" then
SurfaceSides = script.Parent.Size.Z * script.Parent.Size.Y
SurfaceTopAndBottom = script.Parent.Size.X * script.Parent.Size.Z * 2
SurfaceBack = script.Parent.Size.X * script.Parent.Size.Y
TotalSurfaceArea = SurfaceSides + SurfaceTopAndBottom + SurfaceBack
print("The surface area of this wedge is " ..TotalSurfaceArea)
elseif script.Parent.ClassName == "CornerWedgePart" then
end
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
06 Apr 2013 06:46 AM
Bump
Report Abuse
koen500 is not online. koen500
Joined: 23 Feb 2011
Total Posts: 2277
06 Apr 2013 05:10 PM
I have no idea...

Remove the floodcheck!
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
06 Apr 2013 05:11 PM
*Smacks you with books*

LEARN DARN YOU LEARN!
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
06 Apr 2013 05:19 PM
Lrn2Pythagoras
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
06 Apr 2013 05:22 PM
And then after that it's relatively easy.
Report Abuse
tyzone is not online. tyzone
Joined: 16 Aug 2008
Total Posts: 1726
06 Apr 2013 05:23 PM
Wait, the Top/Bottom part for the Wedge is wrong. The top surface isn't x*z, but rather math.sqrt(x^2+y^2)*z.

I'm a tiny bit tired so it might be wrong, but this is what I found.

BottomSurface = x*z
SidesSurface = x*y/2 + z*y/2
TopSurface = x*math.sqrt(z^2+y^2) + z*math.sqrt(x^2+y^2)

Total = BottomSurface + SidesSurface + TopSurface

Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
06 Apr 2013 05:25 PM
@Tyzone
Yah I know, I fixed it in the finished plugin (I counted all the studs by hand to make sure it was correct)
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
06 Apr 2013 05:43 PM
local SurfaceArea = function(Object)
    local X, Y, Z = Object.Size.X, Object.Size.Y, Object.Size.Z
    local Slant = math.sqrt(Y^2+X^2)
    local Trig = (2*(X*2)*Slant+(X*2)^2)/4
    local Side1, Side2 = (X*Y)/2, (Z*Y)/2
    local Ans = Trig+Side1+Side2
    print("Slant: "..Slant.. "|| Inside Triangles: ".. Side1.. ","..Side2.. "|| Answer: ".. Ans)
end

Might work...
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image