So some of you who have taken Physics know that gas flows from High Pressure to Low Pressure. Generally you can argue that a high-pressure gas simply has particles with more energy than the lower pressure gas. In fact you can simulate the entire system by having a box with a bunch of large balls bouncing around, and the box with the higher pressure in general can be assume to have (on average) higher velocities.
Well the cool thing is that you can do a similar thing in Roblox by creating two boxes with balls in them that are at different heights. The box with the balls at a larger height will be considered the higher pressure system (Due to the higher potential energy being converted into Kinetic energy by gravity). In physics, if you were to connect these boxes with a tube, the energy would leak over from the higher pressure system to the lower-pressure system until they equalize.
In the following demo, the green balls start lower than the red balls, making the right side be the high pressure system. As you watch the video you can see that more of the red balls start transferring over to the green side, equalizing the pressure. If you were to leave this system running for an infinite amount of time, in the end the average velocity in each side would be equal, simulating an equal pressure.
Level should be uncopylocked:
PS: This is only possible with the new Solver, because the new solver truly treats Elasticity = 1 objects as objects that conserve energy. If you were to try to do this on Roblox’s default solver, you would notice that energy leaks the system very quickly.
PPS: You’ll see some balls escaping the system, this is because of a limitation in the discreet collision detection. The balls are moving very quickly and essentially teleport around the object in one step. Although I’m looking closer at this to see if that is truly the case.
Neither green nor red balls actually represent high energy because energy is transferred between balls all the time in the system. So I made one that changes its colors according to their kinetic energy(E=mvv).
It’s interesting how I got higher energy than the one I started with, maybe because it was due to Windows’s processing power allocation during black screen (while I was watching a film) increasing delta-t and causing more powerful collisions which result in more power?
Good point on neither the Red or Green balls really representing high energy vs low energy, as this is only true at T=0 (And at T=0, it’s only true if you’re measuring Potential Energy, not Kinetic). Your model of color changing is the more correct way to interpret the flow of pressure over time. My original naive representation is only slightly correct at the beginning. Any chance you’re willing to share your version of the level?
Good point on neither the Red or Green balls really representing high energy vs low energy, as this is only true at T=0 (And at T=0, it’s only true if you’re measuring Potential Energy, not Kinetic). Your model of color changing is the more correct way to interpret the flow of pressure over time. My original naive representation is only slightly correct at the beginning. Any chance you’re willing to share your version of the level? [/quote]
Thank you! Your example showed the flow of starter particles, kinda like a entropy example. I’m attaching the place to this post.
I haven’t looked at your level yet, but all of your particles settling on Red is strange. I’m assuming you’re color specturm isn’t perfectly smooth, so maybe your “high-energy” threshold that you picked is actually the “average” energy of the system?
[quote] Neither green nor red balls actually represent high energy because energy is transferred between balls all the time in the system. So I made one that changes its colors according to their kinetic energy(E=mvv).
[/quote]
Someone give this guy an internship. lol.
[size=1]I might just be a noob for not understanding what you’re talking about, but damn.[/size]
OseDay, I think you’re right about your Color Scheme.
I did a sum of the Potential and Kinetic energies (collisions happen at Y = 5):
local AllBalls = workspace.AllBalls
local LG = BrickColor.new("Lime green")
local BG = BrickColor.new("Bright green")
local C = BrickColor.new("Camo")
local O = BrickColor.new("Olive")
local NO = BrickColor.new("Neon orange")
local MR = BrickColor.new("Medium red")
local BR = BrickColor.new("Bright red")
local totalEnergy = 0
function getTotalEnergy(part)
local KE = (part.Velocity.magnitude^2)*(part.Size.X^3)/70000
local PE = ((part.Position.Y - 5) * 196.2) *(part.Size.X^3)/70000
return KE + PE
end
for i,v in pairs(AllBalls:GetChildren())do
totalEnergy = totalEnergy + getTotalEnergy(v)
end
print("Average Energy: " .. tostring(totalEnergy/#AllBalls:GetChildren()))
The answer comes back at 75.2, which falls in your “Yellow” category. Interesting. The difference in Delta shouldn’t affect Roblox simulation. If anything, we should see slower simulation or faster simulation, but it shouldn’t affect energy being introduced. I’m going to want to run this experiment myself.
I’ve been running the same exact simulation from my previous post about putting all the particles in the same container. Here’s a comparison from now and then:
Did you calculate the average energy BEFORE it go to this state? (The red state)
I’m actually getting some weird results with an updated version of my script where at the beginning the Average Energy fluctuates, but then settles on a semi-consistent value.
local AllBalls = workspace.AllBalls
local LG = BrickColor.new("Lime green")
local BG = BrickColor.new("Bright green")
local C = BrickColor.new("Camo")
local O = BrickColor.new("Olive")
local NO = BrickColor.new("Neon orange")
local MR = BrickColor.new("Medium red")
local BR = BrickColor.new("Bright red")
local totalEnergy = 0
function getTotalEnergy(part)
local KE = (part.Velocity.magnitude^2)*(part.Size.X^3)/70000
local PE = ((part.Position.Y - 5) * 196.2) *(part.Size.X^3)/70000
return KE + PE
end
for i,v in pairs(AllBalls:GetChildren())do
totalEnergy = totalEnergy + getTotalEnergy(v)
end
print("Average Energy: " .. tostring(totalEnergy/#AllBalls:GetChildren()))
counter=1
while wait(0)do
for i,v in pairs(AllBalls:GetChildren())do
if i%200==0 then wait(0)end
local s = (v.Velocity.magnitude^2)*(v.Size.X^3)/70000
if s<8 then
v.BrickColor = LG
elseif s<16 then
v.BrickColor = BG
elseif s<25 then
v.BrickColor = C
elseif s<45 then
v.BrickColor = C
elseif s<85 then
v.BrickColor = O
elseif s<100 then
v.BrickColor = NO
elseif s<130 then
v.BrickColor = MR
elseif s>180 then
v.BrickColor = BR
end
counter = counter + 1
totalEnergy = 0
if counter%200==0 then
counter = 0
for i,v in pairs(AllBalls:GetChildren())do
totalEnergy = totalEnergy + getTotalEnergy(v)
end
print("Average Energy: " .. tostring(totalEnergy/#AllBalls:GetChildren()))
end
end
end
If you copy and paste that into Script, on my screen after a while the entire system sits at an Average Energy of 111.
Anyway, with this version of the script you can see the total energy fluctuate, but the average energy change at the beginning is a little weird. Gonna want to take a look.
EDIT:
Note, it is totally possible for a physics solver to add energy into a complicated system due to not being able to find an “exact” solution to the physics problem.
For example:
The iterative solver tries to break a complicated problem into a set of iterative simpler problems. The idea is that each problem should get it closer to the “True” physics answer. Sometimes, when the equation is complicated enough (IE: A TON of collisions at once) the solver may cut it off after 20 attempts to get the exact answer. This can either add or bleed energy depending on the problem. So it’s totally possible that after hours of running there was a small energy bleed due to this nature.
That being said, I want to investigate this more precisely.
I recorded the average energy every second with your previous script and with the same simulation I’ve been running.
Results:
Average Energy: 237.97771116119
Average Energy: 238.05113804834
Average Energy: 238.72096517047
Average Energy: 238.95567063651
Average Energy: 239.09191633414
Average Energy: 238.39746368277
Average Energy: 238.19059462597
Average Energy: 238.45887585075
Average Energy: 238.37366547071
Average Energy: 238.28583354207
Average Energy: 238.96588939248
Average Energy: 239.36476646684
Average Energy: 240.0401846932
Average Energy: 240.10281395091
Average Energy: 239.15352026088
Average Energy: 239.0133294975
Average Energy: 239.33329490488
Average Energy: 240.0812189072
Average Energy: 240.95180643882
Average Energy: 240.56009559047
Average Energy: 239.50761997408
Average Energy: 239.98679174139
Average Energy: 239.76261924434
Average Energy: 239.77308484652
Average Energy: 240.04889494034
Average Energy: 240.06495788629
Average Energy: 240.29987598432
Average Energy: 240.78349756411
Average Energy: 240.52388684518
Average Energy: 240.56979886477
Average Energy: 240.8815415475
Average Energy: 240.91593361808
Average Energy: 240.5906426846
Average Energy: 241.86665001838
Average Energy: 242.48348100083
Average Energy: 241.59474750107
Average Energy: 240.70229382592
Average Energy: 241.44634890029
Average Energy: 243.22996264725
Average Energy: 242.03263703281
Average Energy: 241.09676299974
Average Energy: 242.47795315825
Average Energy: 242.49205709427
Average Energy: 242.86904402952
Average Energy: 242.94923415613
Average Energy: 243.33100370853
Average Energy: 243.43648963402
Average Energy: 243.10083774677
Average Energy: 242.76951538598
Average Energy: 242.68177808551
Average Energy: 243.12019833155
Average Energy: 243.03302737467
Average Energy: 242.77829470687
Average Energy: 243.06939934502
Average Energy: 243.4630790824
Average Energy: 244.20509603025
Average Energy: 245.05245832598
Average Energy: 244.76327221894
Average Energy: 244.48530502743
Average Energy: 244.11191243395
Average Energy: 244.87251254111
Average Energy: 245.01769469015
Average Energy: 245.20989331476
Average Energy: 244.92334886669
Average Energy: 244.98086417237
Average Energy: 244.77502608625
Average Energy: 244.46792115726
Average Energy: 245.44556427831
Average Energy: 245.20033406941
Average Energy: 245.43587457071
Average Energy: 247.06795888206
Average Energy: 247.58163485176
Average Energy: 245.60885863087
Average Energy: 245.52802630221
Average Energy: 245.93415311255
Average Energy: 246.63697170453
Average Energy: 246.45513591664
Average Energy: 247.01201616861
Average Energy: 247.72214604572
Average Energy: 247.6549283728
Average Energy: 246.4304944097
Average Energy: 246.00982408407
Average Energy: 246.67212526798
Average Energy: 247.57055981934
Average Energy: 247.17079271616
Average Energy: 247.31445699803
Average Energy: 248.23280602128
Average Energy: 247.98256164482
Average Energy: 247.46100737133
Average Energy: 247.75662285951
Average Energy: 248.11591814333
Average Energy: 247.59203943464
Average Energy: 247.53085968493
Average Energy: 248.28606771268
Average Energy: 248.78529321733
Average Energy: 248.61449505133
Average Energy: 247.98504771741
Average Energy: 248.24281830153
Average Energy: 248.67913806326
Average Energy: 249.47679663899
Average Energy: 249.13624743467
Average Energy: 249.20465253141
Average Energy: 249.72192779998
Average Energy: 249.59358736453
Average Energy: 248.80902374448
Average Energy: 249.02382659139
Average Energy: 249.89324975478
Average Energy: 249.67613087574
Average Energy: 249.57020165091
Average Energy: 250.59535532761
Average Energy: 250.53756161427
Average Energy: 250.89285603049
Average Energy: 251.02728631482
Average Energy: 250.90901852302
Average Energy: 250.9258118453
Average Energy: 250.00507215749
Average Energy: 249.25671810301
Average Energy: 251.43259041039
Average Energy: 252.39872802694
Average Energy: 252.45954582152
Average Energy: 251.03525174723
Average Energy: 250.22196017624
Average Energy: 250.18685065204
Average Energy: 251.51354044158
Average Energy: 252.10527783834
Average Energy: 252.26986392948
Average Energy: 251.37693844006
Average Energy: 251.05242895154
Average Energy: 251.96126131356
Average Energy: 252.95857203579
Average Energy: 252.47442537604
Average Energy: 252.60290182253
Average Energy: 252.59598854236
Average Energy: 252.407512425
Average Energy: 252.29397472994
Average Energy: 252.74404843348
Average Energy: 252.52155474569
Average Energy: 253.05565968776
Average Energy: 252.86602331437
Average Energy: 252.99661140731
Average Energy: 253.95992313093
Average Energy: 253.5539943673
Average Energy: 252.74632978391
Average Energy: 253.19304327192
Average Energy: 254.35929547006
Average Energy: 254.15255377743
Average Energy: 254.31569412961
Average Energy: 254.46412034397
Average Energy: 253.69429763386
Average Energy: 253.53324508028
Average Energy: 254.17209656609
Average Energy: 254.46361621677
Average Energy: 255.03374009517
Average Energy: 255.61719766531
Average Energy: 255.59962326605
Average Energy: 255.39501164083
Average Energy: 254.66452676338
Average Energy: 254.288415753
Average Energy: 254.33914013812
Average Energy: 255.5454507648
Average Energy: 255.31414490694
Average Energy: 255.51456793912
Average Energy: 255.71269457075
Average Energy: 255.49905447392
Average Energy: 256.10684869339
Average Energy: 256.47152736142
Average Energy: 255.17339716724
Average Energy: 255.47742671233
Average Energy: 255.63030918549
Average Energy: 256.01286776751
Average Energy: 256.67965929086
Average Energy: 257.01517093096
Average Energy: 256.8734404103
Average Energy: 256.79061011879
Average Energy: 257.17502590989
Average Energy: 258.28074304529
Average Energy: 257.74724845144
Average Energy: 256.92228494774
Average Energy: 257.95591904934
Average Energy: 257.64973420452
Average Energy: 257.10325745268
Average Energy: 257.25191731727
Average Energy: 258.34371017955
Average Energy: 258.380533748
Average Energy: 258.36883093907
Average Energy: 258.62404822129
Average Energy: 258.58985774516
Average Energy: 257.90734728516
Average Energy: 258.8233057726
Average Energy: 259.74888228379
Average Energy: 260.16252763925
Average Energy: 259.90399833067
Average Energy: 258.98767536022
Average Energy: 257.87410036112
Average Energy: 257.86324598268
Average Energy: 260.52629598116
Average Energy: 260.66028602965
Average Energy: 258.7881361355
Average Energy: 258.06122051406
Average Energy: 259.95206081071
Average Energy: 261.55829662883
Average Energy: 261.68938975501
Average Energy: 261.67048662874
Average Energy: 261.03878795288
Average Energy: 259.85570057039
Average Energy: 259.64625120988
Average Energy: 261.06500592423
Average Energy: 262.71982126727
Average Energy: 261.44340914161
Average Energy: 260.08064224246
Average Energy: 260.65659501753
Average Energy: 261.18181467903
Average Energy: 262.16403719243
Average Energy: 262.2406268363
Average Energy: 261.82337669965
Average Energy: 261.02057487959
Average Energy: 261.92754075184
Average Energy: 262.19846779012
Average Energy: 261.87947038319
Average Energy: 261.99902535899
Average Energy: 264.01147074692
Average Energy: 263.33191175657
Average Energy: 262.22950650224
Average Energy: 262.68240693752
Average Energy: 263.14074673598
Average Energy: 264.07025582024
Average Energy: 263.74413880571
Average Energy: 262.37501212837
Average Energy: 261.03533365801
Average Energy: 262.56110894756
Average Energy: 264.37483751808
Average Energy: 263.78926714417
Average Energy: 262.98328247121
Average Energy: 263.42824207299
Average Energy: 262.49989531529
Average Energy: 263.51257768339
Average Energy: 263.72355394945
Average Energy: 264.42173224387
Average Energy: 265.25271558872
Average Energy: 263.77303957174
Average Energy: 262.28731465918
Average Energy: 264.23813107688
Average Energy: 265.14957331818
Average Energy: 265.20824690289
Average Energy: 264.91332058548
Average Energy: 265.47526532586
Average Energy: 265.79694758964
Average Energy: 266.07706447509
Average Energy: 266.67889732927
Average Energy: 265.57342098175
Average Energy: 264.80002494074
Average Energy: 266.50005130724
Average Energy: 267.2284952203
Average Energy: 267.1013987805
Average Energy: 266.6332347456
Average Energy: 267.01884778868
Average Energy: 267.2605765069
Average Energy: 266.3116046452
Average Energy: 266.78185413239
Average Energy: 267.43982586686
Average Energy: 267.0922359698
Average Energy: 266.63629031576
Average Energy: 266.38218173729
Average Energy: 266.32324368447
Average Energy: 268.66862659412
Average Energy: 268.23490938938
Average Energy: 268.02471821145
Average Energy: 268.0656831923
Average Energy: 268.29032416482
Average Energy: 267.65091419828
Average Energy: 267.70032006615
Average Energy: 268.86619019918
Average Energy: 268.60986465179
Average Energy: 268.01634806761
Average Energy: 267.39363453417
Average Energy: 268.28763993321
Average Energy: 269.65254954853
Average Energy: 269.86938398298
Average Energy: 269.95086656665
Average Energy: 269.2779302916
Average Energy: 269.32093784863
Average Energy: 269.36441538436
Average Energy: 270.40398661315
Average Energy: 271.15554647064
Average Energy: 269.97284241501
Average Energy: 269.10666182356
Average Energy: 270.46207501229
Average Energy: 271.10235715739
Average Energy: 270.27742517167
Average Energy: 270.37740786399
Average Energy: 270.20970990627
Average Energy: 270.00145022631
Average Energy: 270.87650851891
Average Energy: 270.08457040112
Average Energy: 269.5461658281
Average Energy: 270.9545178569
Average Energy: 270.80873447651
Average Energy: 271.69578221518
Average Energy: 272.45241247037
Average Energy: 272.5152010895
Average Energy: 272.39481562919
Average Energy: 273.16751895488
Average Energy: 273.80344002826
Average Energy: 272.55779810061
Average Energy: 272.45163640211
Average Energy: 271.52534596769
Average Energy: 272.56681982299
Average Energy: 272.5044555123
Average Energy: 272.92433133081
Average Energy: 274.66593597276
Average Energy: 273.40910802324
Average Energy: 273.3766078587
Average Energy: 273.07223482053
Average Energy: 273.1462389199
Average Energy: 272.95626843885
Average Energy: 274.55161398106
Average Energy: 274.88580302799
Average Energy: 273.58399194495
Average Energy: 272.66857925409
Average Energy: 274.12475220186
Average Energy: 274.88370692088
Average Energy: 274.68027827436
Average Energy: 275.14332753523
Average Energy: 275.97947840998
Average Energy: 274.79772324937
Average Energy: 274.74268794267
Average Energy: 274.40895236618
Average Energy: 274.37933247963
Average Energy: 274.70657522959
Average Energy: 275.13854059036
Average Energy: 275.98557532889
Average Energy: 276.63167872773
Average Energy: 276.06842750377
Average Energy: 275.10636071489
Average Energy: 275.80073197349
Average Energy: 276.13151208895
Average Energy: 275.87695585148
Average Energy: 276.05700836481
Average Energy: 276.54045596128
Average Energy: 277.27850172102
Average Energy: 277.89828965075
Average Energy: 277.56439140372
Average Energy: 276.37335993135
Average Energy: 276.70497559482
Average Energy: 278.89165281345
Average Energy: 278.83189525059
Average Energy: 277.89198144229
Average Energy: 278.45472084163
Average Energy: 277.57209125424
Average Energy: 277.82260398649
Average Energy: 278.49884531422
Average Energy: 278.27393181542
Average Energy: 277.67976301588
Average Energy: 277.94617207533
Average Energy: 278.68294291914
Average Energy: 280.11595840475
Average Energy: 279.72230934614
Average Energy: 279.41820460578
Average Energy: 280.17808582615
Average Energy: 279.964052702
Average Energy: 279.22624289832
Average Energy: 279.03484270567
Average Energy: 278.50870364031
Average Energy: 279.06397957918
Average Energy: 280.7594025368
Average Energy: 280.64975301251
Average Energy: 279.45681121747
Average Energy: 279.69359549817
Average Energy: 281.1747847992
Average Energy: 280.63172475683
Average Energy: 279.30608897336
Average Energy: 278.97257012573
Average Energy: 279.35771321281
Average Energy: 280.10749494109
Average Energy: 280.86734968253
Average Energy: 281.88863653364
Average Energy: 282.2098645699
Average Energy: 280.79012749955
Average Energy: 280.47531498046
Average Energy: 282.42908723027
Average Energy: 284.07288869357
Average Energy: 284.18895066657
Average Energy: 282.9101951397
Average Energy: 281.3986827598
Average Energy: 281.32513871433
Average Energy: 281.11752073202
Average Energy: 281.96022155268
Average Energy: 282.60218719672
Average Energy: 282.13864194081
Average Energy: 281.78881552281
Average Energy: 282.69287132278
Average Energy: 283.80954570083
Average Energy: 284.29634799644
Average Energy: 284.41684896081
Average Energy: 283.70608250011
Average Energy: 282.82596911509
Average Energy: 284.04682261083
Average Energy: 283.07564930198
Average Energy: 282.7996906211
Average Energy: 284.6566150901
Average Energy: 285.35637251687
Average Energy: 284.61798119952
Average Energy: 283.65157027612
Average Energy: 283.78737924837
Average Energy: 283.30177296619
Average Energy: 283.2425879512
Average Energy: 284.39878209177
Average Energy: 284.042239387
Average Energy: 284.30615744157
Average Energy: 284.23058899607
Average Energy: 284.50182981965
Average Energy: 285.85548605941
Average Energy: 285.12847836684
Average Energy: 285.34621857837
Average Energy: 285.75313141182
Average Energy: 285.57568171841
Average Energy: 286.33591793833
Average Energy: 286.51401688979
Average Energy: 286.61113205971
Average Energy: 286.08004858368
Average Energy: 286.12199933521
Average Energy: 286.1809513431
Average Energy: 286.55387555448
Average Energy: 288.01407683148
Average Energy: 287.71372408876
Average Energy: 287.40731609572
Average Energy: 287.24916931415
Average Energy: 286.19367072622
Average Energy: 287.52981480884
Average Energy: 288.23278474466
Average Energy: 288.31496272642
Average Energy: 288.27110146302
Average Energy: 287.96658475793
Average Energy: 288.37335675673
Average Energy: 289.02142410273
Average Energy: 288.82002020163
Average Energy: 287.32436213983
Average Energy: 288.12175691899
Average Energy: 288.45359210228
Average Energy: 289.85779063158
Average Energy: 289.24625943718
Average Energy: 288.50068697143
Average Energy: 289.43253938284
Average Energy: 290.70263024366
Average Energy: 289.7683533009
Average Energy: 288.58160466464
Average Energy: 289.17965392431
Average Energy: 290.06365574366
Average Energy: 290.25656109209
Average Energy: 290.20838702092
Average Energy: 289.67765907482
Average Energy: 289.81358815104
Average Energy: 290.02409624113
Average Energy: 291.07549648335
Average Energy: 291.32245813886
Average Energy: 291.28141952641
Average Energy: 291.05425232963
Average Energy: 290.80058345133
Average Energy: 290.51534108443
Average Energy: 291.37062590862
Average Energy: 290.33929946266
Average Energy: 290.5943000469
Average Energy: 292.63289231228
Average Energy: 292.8064423761
Average Energy: 292.09955317623
Average Energy: 291.81522976545
Average Energy: 291.92323181599
Average Energy: 291.71321571433
Average Energy: 292.22132790401
Average Energy: 293.03063973784
Average Energy: 293.72461077175
Average Energy: 294.62761520441
Average Energy: 293.95335330967
Average Energy: 292.01782576383
Average Energy: 292.42079740615
Average Energy: 293.1243718196
Average Energy: 294.0827627823
Average Energy: 293.2709078252
Average Energy: 294.01070536768
Average Energy: 294.35097207374
Average Energy: 294.35570238147
Average Energy: 294.75194678958
Average Energy: 295.46081099649
Average Energy: 294.41220777066
Average Energy: 294.49319511762
Average Energy: 294.49599730508
Average Energy: 294.65552082848
Average Energy: 293.9136144354
Average Energy: 294.0375638792
Average Energy: 295.41656584101
Average Energy: 296.3750487177
Average Energy: 295.85847230066
Average Energy: 295.54983997381
Average Energy: 294.61792358756
Average Energy: 294.47786174417
Average Energy: 295.46287939807
Average Energy: 294.99427950482
Average Energy: 295.81819069047
Average Energy: 296.23863670815
Average Energy: 296.3187085965
Average Energy: 297.99435413283
Average Energy: 299.41341737707
Average Energy: 299.82030273575
Average Energy: 299.88490713109
Average Energy: 299.15619436382
Average Energy: 299.85257601542
Average Energy: 300.90439537453
Average Energy: 300.99518752672
Average Energy: 299.51021832673
Average Energy: 297.76904253463
Average Energy: 298.57617905122
Average Energy: 300.35593061682
Average Energy: 299.16072693458
Average Energy: 298.88656003866
Average Energy: 299.29235763893
Average Energy: 301.24396612183
Average Energy: 301.72990576054
Average Energy: 301.38275493964
Average Energy: 301.10831406215
Average Energy: 301.56261934084
Average Energy: 301.34040349061
Average Energy: 299.12027658509
Average Energy: 300.0336163587
Average Energy: 300.95555104664
Average Energy: 302.39352667386
Average Energy: 302.69541474919
Average Energy: 301.38695499384
Average Energy: 300.55378250789
Average Energy: 300.54671190178
Average Energy: 301.61290498814
Average Energy: 302.36277348315
Average Energy: 302.80437943663
Average Energy: 302.72950525679
Average Energy: 302.14657826728
Average Energy: 301.93919821771
Average Energy: 302.24069978906
Average Energy: 302.9258628118
Average Energy: 303.71211993876
Average Energy: 303.96499404496
Average Energy: 303.68095758384
Average Energy: 302.52864483386
Average Energy: 303.15143811098
Average Energy: 304.01409211522
Average Energy: 303.8424394592
Average Energy: 304.03195640454
Average Energy: 303.31269895251
Average Energy: 303.02219050452
Average Energy: 304.01385806467
Average Energy: 304.43430319185
Average Energy: 304.24638397674
Average Energy: 304.44668528804
Average Energy: 304.79006353852
Average Energy: 304.02704894701
Average Energy: 303.74146113387
Average Energy: 305.55630448317
Average Energy: 306.90930007997
Average Energy: 306.31998824117
Average Energy: 304.99793142142
Average Energy: 304.89351701982
Average Energy: 304.76738335233
Average Energy: 306.41758476339
Average Energy: 306.31221910802
Average Energy: 306.0817957378
Average Energy: 305.73331042522
Average Energy: 306.73109144432
Average Energy: 305.6791889251
Average Energy: 305.81124677356
Average Energy: 307.38726077488
Average Energy: 308.30809640629
Average Energy: 307.95448269931
Average Energy: 306.36196591418
Average Energy: 306.67975355166
Average Energy: 306.86279079836
Average Energy: 306.90525062913
Average Energy: 307.31150051878
Average Energy: 308.00714789288
Average Energy: 308.1084075816
Average Energy: 307.7512597772
Average Energy: 308.19541304945
Average Energy: 308.75209760732
Average Energy: 308.26945288301
Average Energy: 308.08507420477
Average Energy: 308.25131839238
Average Energy: 309.98619642949
Average Energy: 309.08938682962
Average Energy: 308.65057836483
Average Energy: 309.36332873537
Average Energy: 308.69011160017
Average Energy: 307.80447144635
Average Energy: 307.72162442092
Average Energy: 309.07621495744
Average Energy: 309.64716340599
Average Energy: 309.40968588246
Average Energy: 309.90664733376
Average Energy: 309.98800687231
Average Energy: 310.46598969224
Average Energy: 311.07454483466
Average Energy: 310.55501039654
Average Energy: 308.35921272686
Average Energy: 308.96650065772
Average Energy: 310.29538206265
Average Energy: 310.4886974782
Average Energy: 310.58561464273
Average Energy: 310.86464679591
Average Energy: 310.02889197982
Average Energy: 310.6695811672
Average Energy: 312.12910094495
Average Energy: 311.92568014219
Average Energy: 311.5099180726
Average Energy: 312.32496591832
Average Energy: 311.83020216626
Average Energy: 311.33510491484
Average Energy: 310.91851052389
Average Energy: 312.184866063
Average Energy: 313.70093902815
Average Energy: 312.68129824053
Average Energy: 310.99629110546
Average Energy: 312.27302652323
Average Energy: 313.59172257011
Average Energy: 313.71818375886
Average Energy: 312.25307572811
Average Energy: 312.61173892669
Average Energy: 314.6292035289
Average Energy: 314.15476567606
Average Energy: 312.54281627458
Average Energy: 312.39310304615
Average Energy: 313.16592689393
Average Energy: 315.24045269447
Average Energy: 315.04317903026
Average Energy: 314.68276483976
Average Energy: 315.06868601451
Average Energy: 314.39846489473
Average Energy: 314.64981246769
Average Energy: 315.47551301987
Average Energy: 315.38138455952
Average Energy: 315.59154327236
Average Energy: 315.39629625946
Average Energy: 315.31794295584
Average Energy: 315.20848029339
Average Energy: 315.0085896561
Average Energy: 315.06384195248
Average Energy: 314.6700077603
Average Energy: 314.84301121424
Average Energy: 315.1478034499
Average Energy: 315.56255037189
Average Energy: 316.43524643535
Average Energy: 316.5532233158
Average Energy: 315.58899497682
Average Energy: 315.48361083884
Average Energy: 315.42272316725
Average Energy: 316.1692258662
Average Energy: 317.15561328094
Average Energy: 317.97728539519
Average Energy: 317.98374155457
Average Energy: 317.0978222101
Average Energy: 317.09596428089
Average Energy: 317.48814306415
Average Energy: 317.97824619636
Average Energy: 317.39467419033
Average Energy: 317.43092522465
Average Energy: 316.60742239459
Average Energy: 316.56045835692
Average Energy: 317.51807988416
Average Energy: 318.21784964153
Average Energy: 318.2616994021
Average Energy: 318.0485072058
Average Energy: 317.71819256663
Average Energy: 317.33132401869
Average Energy: 318.43400129713
Average Energy: 318.8296567699
Average Energy: 318.65661766938
Average Energy: 317.92413250524
Average Energy: 317.6277170682
Average Energy: 317.88378646024
Average Energy: 318.26629497066
Average Energy: 319.18097462749
Average Energy: 320.78696308012
Average Energy: 320.26894886106
Average Energy: 318.66481468278
Average Energy: 318.12280033332
Average Energy: 319.36200265934
Average Energy: 319.90308009972
Average Energy: 319.47930014184
Average Energy: 319.62805133919
Average Energy: 320.01903825454
Woah, wait. You were getting THAT MUCH increase every second? Something’s not right.
You’re telling me that on average you got an extra .6 - .8 unit of energy PER EACH BALL per second? Holy crap, that makes no sense. On my machine it looks like a very very very slow increase.
Oh man. Embarassing rookie mistake… I HAVE A DEGREE, I PROMISE #NotAShill
Fixed function.
function getTotalEnergy(part)
local KE = ((part.Velocity.magnitude^2)*(part.Size.X^3)/70000)/2
local PE = ((part.Position.Y - 5) * 196.2) *(part.Size.X^3)/70000
return KE + PE
end
Okay this actually makes sense.
So the average starting energy of the system is 75. Oseday, your “Color” logic basically uses TWICE the Kinetic Energy to set your system.
So lets say we run the system until it reaches steady state. I can make the assumption that the energy will be evenly distributed throughout the system and every ball has the AVERAGE energy.
Well since the average energy is 75, that means you are using 150 for your color scheme, which I believe is red.
Try your test with this code. I am no longer getting much energy fluctuation (well I am getting a bit, but not as much). I think the energy fluctuation can be happening because more energy is converting from Potential to Kinetic. And because we were incorrectly representing the kinetic, it was weighed more heavy, which would give us a perception of increase!!
local AllBalls = workspace.AllBalls
local LG = BrickColor.new("Lime green")
local BG = BrickColor.new("Bright green")
local C = BrickColor.new("Camo")
local O = BrickColor.new("Olive")
local NO = BrickColor.new("Neon orange")
local MR = BrickColor.new("Medium red")
local BR = BrickColor.new("Bright red")
local totalEnergy = 0
wait(5)
function getTotalEnergy(part)
local KE = ((part.Velocity.magnitude^2)*(part.Size.X^3)/70000)/2
local PE = ((part.Position.Y - 5) * 196.2) *(part.Size.X^3)/70000
return KE + PE
end
for i,v in pairs(AllBalls:GetChildren())do
totalEnergy = totalEnergy + getTotalEnergy(v)
end
print("Average Energy: " .. tostring(totalEnergy/#AllBalls:GetChildren()))
counter=1
while wait(0)do
for i,v in pairs(AllBalls:GetChildren())do
if i%200==0 then wait(0)end
local s = (v.Velocity.magnitude^2)*(v.Size.X^3)/70000
if s<8 then
v.BrickColor = LG
elseif s<16 then
v.BrickColor = BG
elseif s<25 then
v.BrickColor = C
elseif s<45 then
v.BrickColor = C
elseif s<85 then
v.BrickColor = O
elseif s<100 then
v.BrickColor = NO
elseif s<130 then
v.BrickColor = MR
elseif s>180 then
v.BrickColor = BR
end
counter = counter + 1
totalEnergy = 0
if counter%200==0 then
counter = 0
for i,v in pairs(AllBalls:GetChildren())do
totalEnergy = totalEnergy + getTotalEnergy(v)
end
print("Average Energy: " .. tostring(totalEnergy/#AllBalls:GetChildren()))
end
end
end