GearBlocks

GearBlocks

Aerodynamics
18 Comments
Axenkov 21 Jun @ 1:21am 
may the universe gift you head 2x a week.
a_ra_ga_l 11 Jan @ 6:29am 
Hi,just wanted to let you know that i uploaded my script:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3405259204

You can test them both to see the differences between your generated forces and mine.
Tjackjesus  [author] 11 Jan @ 1:21am 
Duuuude that’s sick!! The planes looks really good, i’ll have to try it out! Thanks for using the mod and telling me about your creation, it makes me happy to see :)
beeth-oven 10 Jan @ 9:01pm 
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3404883147 I was able to make this with your mod. very nice.
Tjackjesus  [author] 8 Jan @ 8:11am 
Oh i didnt know that was something people wanted, i thought theyd enjoy being able to run it in the background, i see. But yeah no worries dude, i understand! I appreciate the feedback nontheless. Thanks for the kind words :) Good luck on your script!
a_ra_ga_l 8 Jan @ 7:57am 
Regarding all ather piints - as i mentioned overal script is awesome
I have no complains just opinion (as i was just expecting real life physics)
If in case my observations where wrong or misleading sorry - did not spend too much time in your code and english is not my first language.
Either way i'll be waiting for updates to see how it goes for you. And in a mean time i think i'll try to create my own interpretation of realistic aerodinamics (not promising it will be better)
a_ra_ga_l 8 Jan @ 7:52am 
Regarding first point - yes
When you close a window script is still working in a background.
To turn of script you need to implement UnloadScript function in your code
Personally i call this function in Window.OnClose event listener
Tjackjesus  [author] 8 Jan @ 6:28am 
1. please call "UnloadScript.Raise( <ScriptName> )" function on main windows close - because now script is not being offloaded after closing main window."

Sorry, what do you mean, like the script isnt being closed when you close down the UI?
Tjackjesus  [author] 8 Jan @ 6:27am 
Beams do create different drag depending on the orientation, every object does. And i understand what you mean with that players shouldnt be allowed to change the forces, but im not looking to create a difficult to use, intricate mod, im looking to create something thatll allow you to do what you want, however you want it, its not meant to be hyper realistic, its meant to be fun, reliable, accurate(not realistic) and easy to use, and easy to adapt to personal preference. I prefer using it with 0.7 aero and 0.6 drag, but not everyone would. So i chose to add the option. And yes, ive written it explicitly in the description, im well aware that the optimization is bad, but i will be adding not only performance mode(with less accuracy) but also optimize it further, its far from done after all.

And the shape, i will add logic for this too ofcourse. I appreciate your feedback though, ill look into many of these points today, and see what i can do! :) Thanks for the kind words
a_ra_ga_l 8 Jan @ 3:34am 
6. i have not checked math (directions) behind your calculations, but at least from my point of view beams should create a different drag depending on orientation as effected area changes (from 1x10 to 1x1)

Long story short - as an attempt it is really straight forward and impressive. And if it raises an aircraft up to the sky it does it's job :steamthumbsup:. But from physics perspective it is still very long way from being close to true aerodynamics.
a_ra_ga_l 8 Jan @ 3:34am 
3. in you case i would google out Air Friction forces (of real life) and would start from here. I don't thing that letting user to decide force amplifier is a good practice. (while i do admit it is way easier and also lets user to lift up even those creations that should not be in air)
4. this should have been expected, but on complex creations script really takes out frame rate - not sure if any optimizations could be done be mindful of that
5. i tested this script with car. good news - it did not lift off :D. But drag was too big - My theoretical calculations shows that without drag car should reach 586 km\h (in game without script reaches ~570 km/h) and with drag should reach ~380 km/h (in game with script only reaches 140 km/h). This might be doe to aerodynamics effecting parts that should not be effected, or effecting parts in incorrect direction.
a_ra_ga_l 8 Jan @ 3:33am 
Hi again
1. please call "UnloadScript.Raise( <ScriptName> )" function on main windows close - because now script is not being offloaded after closing main window.
2. i truly imagined that you where checking part shapes and orientations in regards to velocity direction. While i do see you calculating separate velocities of separate parts i do not find anything related to part shapes.
* for example image two wings of same area, but one has long wing span and short wing root (10:1) while other is has medium wing span and medium wing root (5:5) - how do you think which wind will have more list and which will have more drag if both of them are in the same angle ?
* this is the most important and most head hurting part.
Tjackjesus  [author] 7 Jan @ 5:15pm 
Yes thats okay, as long as you wont republish it under your own name in any way, you're free to do what you want with it :), however theres no guarantee that i'd use your code, atleast not to its entirety.

Also i forgot to mention, you asked about mass and i said no it doesnt change it, it does actually change it, because the objects have different masses in game, meaning theyre differently hard to move, lightweight objects are affected MASSIVELY by drag, while heavy arent as much, so the logic is there, i just didnt manually add it.
a_ra_ga_l 7 Jan @ 5:07pm 
Ok - thanks for all the answers
Now i have an idea of what to expect in code
I'll review it and come back to you again in case i see an area for improvement.

And just a question hefore hand:
In case after seeing you approach, i'll dice that there is a better way to do this (but the one that would require rewriting most of your code) - are you cool if i would just compile my own script and share it with reference to yours ?
Tjackjesus  [author] 7 Jan @ 4:54pm 
I almost forgot to answer this "Before i dive into the code (with the intent to help you improve this script), i was hoping you could explain the basic logick behind the mechanics."

I can try to explain it, i cant go too detailed due to max characters though.

First of all, it finds all objects, filters them , then stores them in a table, with their size. Then loops through the stored table calculate the local velocity. And skipping some parts of the code, it calculates lift by some math using a mix of Y velocity, Area, and a tiny bit of the X/Z velocity. It calculates drag in the similar way, then, this is all applied to the object in the opposite direction, so if its moving upward at a speed of 300 units, itll apply a force downwards with a force of 300 units * area + other stuff, same for downward, so it dampens the vectors, which effectively creates lift and drag
Tjackjesus  [author] 7 Jan @ 4:41pm 
5
Yes, it does take into account the part size, both for drag and for lift. And i think, if i understand your question correctly, that yes, it calculates area affected by air friction. Thicker blocks have hugely much more drag and work way worse as lift surfaces.

6
No, but its an interesting idea, i like it, ill look at this honestly.

7
It does apply calculations to all the parts yes, it doesnt separate which parts are outside and should be affected, you could enclose a plate within boxes and it would still have the forces, but i have been considering, adding some logic for it to sense what sides are blocked, and negate lift/drag on those sides.

comment 2/2 (Max character limit was being gay)

Thanks forthe questions dude :) Dont hesistate to ask again if you have more!
Tjackjesus  [author] 7 Jan @ 4:40pm 
Hey!

1
Both lift and drag :)

2
No, at the moment it doesnt take into account the weight to calculate any kind of momentum.

3
Ofcourse, its the base of how it all works, it uses velocity as the primary source of info!

4
Yes absolutely! Its fully local to the object, you can fly a plane upside down, sideways, anything, its all local and works nonetheless

comment 1/2
a_ra_ga_l 7 Jan @ 4:29pm 
Nice idea
Straight away i hane miltiple questions:
* Does it only create lift or drag too ?
* Does it take into acoount part weight to calculate momentum, or are you fully relying on momentum calculated by game ?
* Does it take into account speed/velocity (as both lift and drag depends on it)
* Does it take into account part rotation in space compared to direction of velocity ?
* Does it take into account part size ? And deas it calculate area effected by air friction ?
* Does it take into account material friction (because depending on it, instead of a good lift you might get unintended drag) ?
* Does it aply calculations to all parts ? Or does it somehow identify/seperate which parts are outside and should be effected ?

Before i dive into the code (with the intent to help you improve this script), i was hoping you could explain the basic logick behind the mechanics.