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
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
| |
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 06 Apr 2013 05:10 PM |
I have no idea...
Remove the floodcheck! |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|