Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is the appropriate equations for smashable glass?

Asked by
WVPII 5
9 years ago

So here is what I've stuck together, and has some ALRIGHT results, looking like this: https://gyazo.com/f7a370680579f3669a9522db4e2a6e1a

The bits in front are products of the script, and the bit behind is a replica of the part that was converted

01local event = game.ReplicatedStorage.Remotes.Weapon.Smash
02 
03function event.OnServerInvoke(plr, objHit)
04    --MATHS
05    local size = objHit.Size
06    local centerpos = objHit.Position
07    local width = size.X / 3
08    local hight = size.Y / 3
09    local x1 = centerpos.X * 2
10    local x2 = x1 / 3
11    local y = centerpos.Y * 2
12    local y2 = y / 3
13    local position = Vector3.new(x2, y2, centerpos.Z)
14    local sizenew = Vector3.new(width / 3, hight / 3, size.Z)
15    local positions = {{position.X, position.Y, position.Z}, {position.X + width, position.Y, position.Z}, {position.X + (width * 2), position.Y, position.Z}--//Firstline--//
View all 39 lines...

2 answers

Log in to vote
0
Answered by 9 years ago
01local event = game.ReplicatedStorage.Remotes.Weapon.Smash
02 
03function event.OnServerInvoke(plr, objHit)
04    --MATHS
05    local size = objHit.Size
06    local originalpos = objHit.Position
07    local orix = size.X
08    local oriy = size.Y
09    local oriz = size.Z
10    local x = orix / 3
11    local y = oriy / 3
12    local z = oriz
13    local x1 = originalpos.X
14    local x2 = x1 - x
15    local y1 = originalpos.Y
View all 35 lines...

x1 and y1 represent the center and since it is a 3 by 3 you do some algebra to get this

Ad
Log in to vote
0
Answered by 9 years ago

There's a smashable glass thing as a model in the toolbox, probably some kind of formula in there

Answer this question