Jump to content

uscespc

Members
  • Posts

    20
  • Joined

  • Last visited

Posts posted by uscespc

  1. How about a fake helicopter meaning it uses no aerodynamic forces just Unity rigidbody magic.

    The model isn't much but it looks like a helicopter, is colorful and works to test with.

    This is just an exercise in writing a mod.

    This version of the mod allows the craft to take off, turn to, fly to and land at any lat/lon selected by map, target, waypoint or saved location.

    And BD Armory is always fun.

     

  2. 54 minutes ago, darthgently said:

    Are there any mods required for the hydrofoil effect to work?  I'd like to try that approach on Eve and Laythe.  Maybe some kind of rover with a foil that can be lowered or something

    It uses a mod I wrote that in hydrofoil mode maintains a pitch/roll of 0/0 and constantly adjusts the wing  pitch trim to maintain a set height above the water.

    A stock only deployable hydrofoil might be possible just never tried it.

    The parts I used for the hydrofoil are the  MRS Aerodynamic Pylon, Large and FAT-455 Aeroplane Control Surface.

    Also there some hydrofoils on KerbalX that might give you some ideas.

    Good Luck

     

     

     

  3. My collection of useless crafts/mods, a DSEV, The Flying Sub and a 688 sub.
    I play at writing mods so I found these models, tweaked them to work with KSP and wrote mods to control them.

    One of these days I'll come up with an idea for something useful.

    1enBdsh.png

    Here's a video of the in action

  4. I get this error:

    EXC 19:02:04.606] ArgumentException: An item with the same key has already been added. Key: [PluginData/Skins/evileye.x_DIF.png, NavBallTextureChanger.FileEmissive]
    	System.Collections.Generic.TreeSet`1[T].AddIfNotPresent (T item) (at <376e8c39bbab4f1193a569c8dbe4305c>:0)
    	System.Collections.Generic.SortedSet`1[T].Add (T item) (at <376e8c39bbab4f1193a569c8dbe4305c>:0)
    	System.Collections.Generic.SortedDictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <376e8c39bbab4f1193a569c8dbe4305c>:0)
    	NavBallTextureChanger.TextureSelector.LoadTextureConfigs () (at <cb3d6b977544452da6f44c5b84dac379>:0)
    	NavBallTextureChanger.TextureSelector.Start () (at <cb3d6b977544452da6f44c5b84dac379>:0)
    	UnityEngine.DebugLogHandler:LogException(Exception, Object)
    	ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    	UnityEngine.Debug:CallOverridenDebugHandler(Exception, Object)

    Removed the two files and it works.

  5. 7 minutes ago, linuxgurugamer said:

    What's  the range, and does it drop in strength ?

    I don't know what the max range could be, it's just a FixedJoint so whatever the limits for that are. I've tested it at 100m.

    As for strength I have the breaking forces set to Mathf.Infinity but it would be easy to have the strength decrease with increased distance or just set a max range for use.

    And for more realism FixedJoint has currentForce and currentTorque parameters you could monitor and take action when thresholds are reached.

    Also a ConfigurableJoint might be a better option but so many parameters and few examples on setting one up.

    This is just an adaptation of the magnets found in numerous mods.

    TY for the like, I use many of the mods you maintain.

  6. I'm not much of a modeler(as you can see) or coder but I like to play at it just to see if it can be done and can I do it and this is one of my projects a Tractor Beam.

    It's part of the craft which is another project and not standalone and can only pick things up which is what I intended.

    I have no idea how well it plays with most of the stock items or other mods, this is a test setup with minimal mods;

    The girder is from Near Future Construction and the containers, target I created to test with.

     

     

     

     

     

  7. On 11/14/2019 at 3:13 PM, flywlyx said:

    I would suggest multiple ray cast to hover the vessel. When you are on water, use altitude replace ray cast, all other calculation stays the same.

    Check the hover craft MOD I made previously.

    https://github.com/flywlyx/Hover-Craft

    Thank You

    Looking at your code gave me a clue on how to solve the land to water transition. On land I use raycasts with a PID controller to adjust power to the hover nodes and this didn't work over water.

    In your code I saw you use  height = FlightGlobals.getAltitudeAtPos(rcTransform.position); so once I detect the transition from land to water I use this value in the PID controller Error field.

    Land: HForce = PIDController(TargetHeight, hit.distance)

    Water:  HForce = PIDController(TargetHeight, height)

    Works great, never thought it would be this simple.

    Here is a video showing land to water and back.

    Demo3

     

  8. 18 hours ago, sarbian said:

    Have you tried to use a different layer for your raycast ? I am quite sure one layer actually works on water so you could combine it with the one you use for the ground. S

    I tried them all 0-32 the only ones that returned hits were 10 Scaled Scenery and 15 Local Scenery. I use 15, 10's hit info was inconsistent.

    Thanks for the suggestion.

  9. 10 minutes ago, Gargamel said:

    @uscespc, I'm a little unclear about what you are talking about?   Are you having issues flying a craft, or are you trying to write code to make a hovercraft mod?

     

    It's all code, I've solved the thrust, turning, hover issues it's when you are hovering over land and cross over to water, water doesn't return raycasts which I use in a PID,  AddForceAtPosition  construct to hover.

    Video2

  10. I created a hovercraft that works well on land but I'm having a problem with water. 

    When you transition from land to water the craft maintains the attitude it had on land, this is because it's transitioning from raycast feedback to just plain addforce over water.

    What I would like to do is level the craft over water but I can't seem to find a way to do it.

    The video shows the land water transition.

    Just looking for some suggestions or places to look.

    Thanks

    Video

  11. I have a cube that I use:  transform.Position = Vector3.up * Mathf.Cos(Time.time);  in Update and it floats up and down on the Y axis just fine in the Editor .

    On the runway Object Inspector shows the Y axis values being changed but the cube moves left and right.

    DebugStuff shows the transform Y axis to be pointing up.

    I'm missing something , doing something wrong or just don't understand something.

    Any suggestions on where to start looking?

    Thanks

  12. 21 hours ago, Lisias said:

    Well, you are getting a division by zero or some other math accident on the code!

    
    rPos: [NaN, NaN, NaN]   rVel: [NaN, NaN, NaN] |NaN|
    Delta: [NaN, NaN, NaN] / [NaN, NaN, NaN]

    The problem happened at 1.000 meters apparently. And I think it can be related to the 3D World rendering instead of the physics engine - something happens at 1.000 meters. But without the code, it's a blind guess - with the code we will be guessing too, but at least we would be seeing what we are guessing. :)

    — — — POST EDIT — — —

    I run a small test: got a rocket, activated the infinite fuel cheat and launch it with the smallest vertical velocity I managed to set - of course, with SAS activated and keeping the nose straight up (at 90° marker on the Navball).

    You will notice that the ship will "drift" to west slowly. This is Kerbin rotating under you - winds are not simulated on KSP.

    Division by zero happens when the dividend gets smaller and smaller until you have a underflow and the float is "rounded" to zero. Assuming this is what happened on the code, something that never goes to zero is... going to zero, and then things go through the tubes.

    One thing that is never zero once you are flying are the angular speed of Kerbin. Since KSP "centers" the universe around your ship (i.e., everything moves around you for simulating you moving around - this is a trick needed due Unity using floats and not doubles on the physics  - something needed as GPUs are tremendously faster handling floats than handling doubles), Kerbin is not moving under you when you are landed - but once you are flying, this is something that cannot be zero.

    Ok, this is a wild, blind guess. But it's something to start looking into the problem. :)

    Finally got one to work.

    In version 1 the shuttle was rigidly constrained by the shaft, version 2 uses a 4x4 hollow shaft with a 3.5x3.5 shuttle in the middle allowing for drift.

    As the shuttle goes up it will drift back and forth but doesn't crash the game.

    I'm also using this code in FixedUpdate:  (have to test if removing makes a difference)

     part.Rigidbody.angularVelocity *= 0;
     vessel.angularMomentum = Vector3.zero;

    Here's a pic at 59.5Km (I stopped there to test stopping)

     

     

     

     

     

  13. The shaft is the easy part. I did it 3 ways.

    1. Create it in Blender and make it 60000m high.

    2. Create a 20m shaft in Blender and scale it in Unity by 3000.

    3.  I was able to adapt the code in linuxgurugamer's NRAP mod and created a shaft you could scale to any height.

    I then created a shuttle that could move up the shaft and that's where I had problems. After a point the games blows up with the following log entries:

    I'm not sure what is causing the problem PRE or just game mechanics.

    Errors

    Video

    BTW: I'm not much of a modeler or a coder.

    Just FYI it was interesting getting to this point.

  14. I'm using Unity 2017.1.3p1 Personal and am seeing different .anim file structures based on the following:

    1. Project Settings ---> Editor ---> Asset Serialization Mode = Force Text (KSP fails to load part)
    2. Project Settings ---> Editor ---> Asset Serialization Mode = Force Binary and then do Project Settings ---> Editor ---> Asset Serialization Mode = Force Text (part and animation work fine after editing)

    In scenario 2 I remove material from the attribute and change classID from 23 to 21 for it to work.

    Is this a known Unity problem,  a known work around or am I just doing something wrong?

    Thanks

    [snip]

×
×
  • Create New...