Fengist 1,319 Posted July 24, 2016 Share Posted July 24, 2016 (edited) So, if you haven't been watching my frustration with drag cubes in this thread: You're missing all the fun! I realize not everyone is going to be needing to play with drag cubes. But trust me on this, if you create parts, sooner or later, it's going to catch up to you. Here's a tidbit I learned in my experiments that I haven't read anywhere. If you add in a DRAG_CUBE to your part.cfg, it will overwrite the PartDatabase.cfg! It'll even change the entry in the PartDatabase.cfg to match your part.cfg entry. That means, if you screw up and release a part that's HUGE (not that anyone around here would do that), you're going to need to add in a fixed drag cube to your part.cfg file. Otherwise, that database entry won't get recalculated unless your end user is using Module Manager. And since not all of us do, you best make sure you put a manual drag cube in your .cfg file. Next problem. And this won't affect everyone but it affects me hugely. Drag cubes have a serious effect on drag AND buoyancy. So much so, I've come to the realization that I need to manually adjust any part that I have that comes into contact with the water. That's a lot of parts. And if you've seen the mess that the drag cube entry is... it's not pretty. cube = Default, 14.605,0.3707,4.811, 14.605,0.3729,4.811, 18.040,0.31955,5.828, 18.040,0.28225,2.854, 14.71,0.3717,4.811, 14.71,0.3728,4.811, 0,3.73,0, 7.236,7.46,7.236 Yea, so trying to 'tweak' the drag cubes for a bunch of parts and having to run that through a calculator and manually enter in the new values? Right... I didn't learn programming to waste my time with a calculator. I present: Fengist's Drag Cube Calculator http://www.datainterlock.com/dragcubes.php Ok, this is easy. Copy the line from the drag cube, like the one above... and paste it into the text field on this web page. Next, enter in the percentage change you want to each of the 3 fields... area, drag, depth. And, through the magic of PHP, it'll spit out an adjusted drag cube with the new values. Paste it into your .cfg file and voila... a customized drag cube and you didn't have to do any math. Now pardon me while I go facedesk a few more times... And should anyone want their own, here's the source code. I hacked this together in about 15 minutes so it's not even close to pretty. It just works. Do as you wish with it. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php if (isset($_POST["button"]) && $_POST["button"]=="Submit") { //var_dump($_POST); if ($_POST["DragCube"]>'') { echo '<h2>Calculations</h2> <br>'; echo 'Original Drag Cube: '.$_POST["DragCube"].'<br>'; $firstcut = explode('=',$_POST["DragCube"]); $secondcut = explode(',',$firstcut[1]); $title = $secondcut[0]; $outstring = 'cube = '.$title; $looper = 1; for ($x=1;$x<19;$x++) { switch ($looper) { case 1: { $newvalue = $secondcut[$x] * (floatval($_POST["AreaModifier"] / 100)); echo 'Area: '.$secondcut[$x].' -> '.$newvalue.' '; break; } case 2: { $newvalue = $secondcut[$x] * (floatval($_POST["DragPercentage"] / 100)); echo 'Drag: '.$secondcut[$x].' -> '.$newvalue.' '; break; } case 3: { $newvalue = $secondcut[$x] * (floatval($_POST["DepthPercentage"] / 100)); echo 'Depth: '.$secondcut[$x].' -> '.$newvalue.'<br>'; break; } } $outstring .= ','; $looper++; if ($looper > 3) { $looper = 1; } $outstring .= $newvalue; } for ($x=19;$x<25;$x++) { $outstring .= ','.$secondcut[$x]; } echo '<br>'; echo '<h2>New Drag Cube</h2><br>'; echo 'DRAG_CUBE<br>'; echo '{<br>'; echo ' '.$outstring.'<br>'; echo '}<br>'; echo '<hr>'; } } if (isset($_POST["AreaModifier"])) { $v1 = $_POST["AreaModifier"]; } else { $v1 = 100; } if (isset($_POST["DragPercentage"])) { $v2 = $_POST["DragPercentage"]; } else { $v2 = 100; } if (isset($_POST["DepthPercentage"])) { $v3 = $_POST["DepthPercentage"]; } else { $v3 = 100; } ?> <form id="form1" name="form1" method="post" action=""> <h2> Fengist's Drag Cube Modifier </h2> This is a KSP Drag Cube modifier. It's purpose is to simply recalculate drag cubes based on a percentage of the original values. Copy the single line representing the drag cube from the PartDatabase.cfg and paste it in the text box below. Change the percentages to the new desired value and click submit. <p>Paste your one line from your Drag Cube below.</p> <p>It should look like this:</p> <p>cube = Default, 14.605,0.3707,4.811, 14.605,0.3729,4.811, 18.040,0.31955,5.828, 18.040,0.28225,2.854, 14.71,0.3717,4.811, 14.71,0.3728,4.811, 0,3.73,0, 7.236,7.46,7.236 </p> <p>Original Drag Cube <input name="DragCube" type="text" id="DragCube" size="100" maxlength="200" /> </p> Enter in the percentage change you'd like to make to each of the 3 values. <p>Area Percentage Modifier <input name="AreaModifier" type="text" id="AreaModifier" value="<?php echo $v1; ?>" maxlength="3" /> </p> <p>Drag Percentage Modifier <input name="DragPercentage" type="text" id="DragPercentage" value="<?php echo $v2; ?>" maxlength="3" /> </p> <p>Depth Percentage Modifier <input name="DepthPercentage" type="text" id="DepthPercentage" value="<?php echo $v3; ?>" maxlength="3" /> </p> <p> <input type="submit" name="button" id="button" value="Submit" /> </p> </form> </body> </html> Edited July 24, 2016 by Fengist Quote Link to post Share on other sites
iFlyAllTheTime 32 Posted January 6, 2019 Share Posted January 6, 2019 (edited) Hi, Sorry to revive this old thread, but it's directly related to your post. This might be something I'm looking for. But I want to make sure I understand and implement this properly. Here's what I'm trying to do: I running 1.2.2 (yeah, I don't see any reason to abandon that save and restart in a newer version) and I need to change the drag on the part below: PART { url = NearFutureSpacecraft/Parts/RCS/rcsblock-aero/rcsblock-aero-5way-1/rcsblock-aero-5way-1 DRAG_CUBE { cube = Default, 0.114,0.9575,0.1246, 0.114,0.7514,0.2121, 0.03761,0.6311,0.3331, 0.03761,0.6303,0.3377, 0.03762,0.6281,0.3331, 0.03762,0.6307,0.3377, -0.04475,0.0001625,2.205E-09, 0.1381,0.3859,0.3859 } It's an RCS thruster block that I use on my spaceplane—I want to reduce the drag created by it to about half its original value. I found the above values from the PartDatabase.cfg from my game directory, and after copying them into your calculator and setting the "Drag Percentage Modifier" to 50%, I am presented with the "Calculations" and "New Drag Cube" values. If I understand it right, I just need to place these values and the drag created by this part will be reduced. Where do I place these values? On 7/23/2016 at 10:57 PM, Fengist said: Paste it into your .cfg file and voila... Which cfg file are you referring to? The PartDatabase.cfg or the actual part cfg file from the Gamedata folder? Appreciate your work and any help you are willing to dispense. Edited January 6, 2019 by iFlyAllTheTime Added your quote for clarification Quote Link to post Share on other sites
SpannerMonkey(smce) 3,030 Posted January 6, 2019 Share Posted January 6, 2019 14 hours ago, iFlyAllTheTime said: Which cfg file are you referring to? Hi use this tool a lot for all kinds of things , so very familiar with it's use . The modified drag cube has to go into the parts cfg, Only this way will it be permanent and unchanged, if you paste the modded version into the part database cfg it will be rewritten at every load and return to the undesirable drag values , you can put it anywhere in cfg although i've gone the squad way and paste it in just before the part modules. Quote Link to post Share on other sites
iFlyAllTheTime 32 Posted January 6, 2019 Share Posted January 6, 2019 3 hours ago, SpannerMonkey(smce) said: Hi use this tool a lot for all kinds of things , so very familiar with it's use . 3 Fantastic! I hope you don't mind if I pick your brain a little more... The following is the part cfg file //// Near Future Spacecraft 0.5.4 // Shielded 5-Way RCS Block PART { // --- general parameters --- name = rcsblock-aero-5way-1 module = Part author = ChrisAdderley // --- asset parameters --- MODEL { model = NearFutureSpacecraft/Parts/RCS/rcsblock-aero/rcsblock-aero-5way-1 position = 0.0, 0.0, 0.0 scale = 1,1,1 rotation = 0, 0, 0 } scale = 1 // --- node definitions --- // definition format is Position X, Position Y, Position Z, Up X, Up Y, Up Z node_attach = 0.00, -0.0, -0.00, 1.0, 0.0, 0.0 // --- editor parameters --- TechRequired = specializedControl entryCost = 4000 cost = 650 category = Control subcategory = 0 title = RV-105x5 RCS Thruster Block manufacturer = STEADLER Engineering Corps description = This aerodynamically shielded thruster block has a fifth nozzle for improved maneuvering. This comes at the cost of slightly lower total thrusts. // attachment rules: stack, srfAttach, allowStack, allowSrfAttach, allowCollision attachRules = 0,1,0,0,0 // --- standard part parameters --- mass = 0.07 dragModelType = default maximum_drag = 0.001 minimum_drag = 0.001 angularDrag = 2 crashTolerance = 15 maxTemp = 2300 bulkheadProfiles = srf tags = cluster control dock maneuver manoeuvre react rendezvous rotate stab steer translate shielded nearfuture // --- rcs module parameters --- EFFECTS { running { AUDIO_MULTI_POOL { channel = Ship transformName = thrustVector clip = sound_rocket_mini volume = 0.0 0.0 volume = 0.1 0.0 volume = 0.5 0.025 volume = 1.0 0.1 pitch = 0.0 0.75 pitch = 1.0 1.5 loop = true } MODEL_MULTI_PARTICLE { modelName = Squad/FX/Monoprop_small transformName = thrustVector emission = 0.0 0.0 emission = 0.1 0.0 emission = 1.0 1.0 speed = 0.0 0.8 speed = 1.0 1.0 localRotation = -90, 0, 0 } } } MODULE { name = ModuleRCSFX thrusterTransformName = thrustVector thrusterPower = 0.9 tagingEnabled = False resourceFlowMode = STAGE_PRIORITY_FLOW resourceName = MonoPropellant runningEffectName = running atmosphereCurve { key = 0 240 key = 1 100 } } } If I understand this correctly, I need to paste everything after "url = NearFutureSpacecraft...." all the way to the very last value "... 0.3859" inside of the "PART {..........................}" in the text file? Quote Link to post Share on other sites
SpannerMonkey(smce) 3,030 Posted January 6, 2019 Share Posted January 6, 2019 3 minutes ago, iFlyAllTheTime said: If I understand this correctly, I need to paste everything after "url = NearFutureSpacecraft...." all the way to the very last value "... 0.3859" inside of the "PART {..........................}" in the text file? You've lost me there, if you have the part as above, you copy the parts original drag cube( from the partdatabase.cfg into the online tool, nothing else, then using the same format paste the results back into your part cfg, no need to create another cfg . an example below Spoiler PART { name = xxxxxxxxxxx module = Part author = xxxxxxxxxx // -2.33 CoMOffset = 0.0, -2.33, 0 MODEL { model = xxxxxxxxx/xxxxxx/xxxx scale = 1.0, 1.0, 1.0 } rescaleFactor = 1 NODE { name = Node1 //HULL transform = Node1 size = 2 method = FIXED_JOINT } NODE { name = Node2 //HULL transform = Node2 size = 2 method = FIXED_JOINT } TechRequired = aerodynamicSystems entryCost = 2600 cost = 1250 category = Aero subcategory = 0 title = xxxxxxxxxxxxx manufacturer = xxxxxxxxxxxxxxxxxxx description = xxxxxxxxxxxxxxxxxxxxxxx mass = 13 dragModelType = default maximum_drag = 0.1 minimum_drag = 0.1 angularDrag = 2 crashTolerance = 30 breakingForce = 200 breakingTorque = 200 maxTemp = 4000 skinMaxTemp = 4000 //vesselType = Ship fuelCrossFeed = True bulkheadProfiles = size1 DRAG_CUBE { cube = A, 50.29,0.49224,4.942,50.29,0.48912,8.56,16.02,0.57048,19.85,16.02,0.45376,20.34,229.3,0.78936,0.8803,229.3,0.74184,2.983, -0.002204,-0.7631,-0.5761, 9.722,20.22,2.918 cube = B, 50.29,0.49224,4.942,50.29,0.48912,8.56,16.02,0.57048,19.85,16.02,0.45376,20.34,229.3,0.78936,0.8803,229.3,0.74184,2.983, -0.002204,-0.7631,-0.5761, 9.722,20.22,2.918 } ///////////////////////////////////////////////ANIMATIONS//////////////////////// MODULE { name = ModuleAnimateGeneric layer = 1 } MODULE { name = ModuleCargoBay } MODULE { name = ModuleAnimateGeneric layer = 2 } MODULE { name = ModuleCargoBay DeployModuleIndex = 2 closedPosition = 0 lookupRadius = 2.5 nodeInnerForeID = Node17 nodeInnerAftID = Node13 } MODULE { name = ModuleReactionWheel PitchTorque = 100 YawTorque = 80 RollTorque = 40 RESOURCE { } } //////LIFTING BODY///////////////////////////////// MODULE { } //////////////////////GENERATOR//////////////////////// MODULE { { } OUTPUT_RESOURCE { } } RESOURCE { } RESOURCE { } } Quote Link to post Share on other sites
iFlyAllTheTime 32 Posted January 7, 2019 Share Posted January 7, 2019 @SpannerMonkey(smce) Thank you for the example! I get it now. Quote Link to post Share on other sites
TheKurgan 596 Posted August 21, 2020 Share Posted August 21, 2020 It's back! Thanks! That has been an invaluable tool for me, for years. I have not had to use it in the past few months, but I used it regularly in the past, and now I have to fix several drag cubes. When I saw the 404 error, I was like "OMG I am screwed... I have ZERO clue how to fix these without this tool" Thanks again. Quote Link to post Share on other sites
TheKurgan 596 Posted January 24 Share Posted January 24 It's gone again Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.