Jump to content

[1.0.x] [V1.9f] Kerbal Foundries wheels, anti-grav repulsors and tracks


lo-fi

What to work on next?  

1,282 members have voted

  1. 1. What to work on next?

    • More wheels
      123
    • More tracks
      453
    • Rover bodies
      241
    • Landing gear
      137
    • Landing legs
      108
    • Something completely different
      193


Recommended Posts

I have a stupid question; those are my job. Can't bump-stop largely be handled by a protrusion on the part the shape of the wheel (less a bit for tyre compression fore and aft) with the suspension fully compressed?

Link to comment
Share on other sites

@lo-fi

What if it isn't the anchor points that are being screwed up in KSP, but the anchor axis directions?  That would cause the effect that I was seeing, as it would try to rotate the RB into position relative to the axis. I know for certain that on the Launchpad Vector3.up != transform.up even for a vertically aligned transform.

I don't remember offhand if you were using world-axis setups for the anchor axis assignments, or transform axis.  I also don't know what frame the joints are -supposed- to be setup in (world, local).  Anyhow, just a thought that popped into my head that might explain part of what was seen on the joint-based setup...

15 hours ago, damerell said:

I have a stupid question; those are my job. Can't bump-stop largely be handled by a protrusion on the part the shape of the wheel (less a bit for tyre compression fore and aft) with the suspension fully compressed?

Yes, and no.

Yes, technically it can, or at least should be possible.  No, in reality it cannot as standard colliders do very strange stuff when used like that.  They like to 'snag' on seams between triangles, and will certainly come to an abrupt stop if they hit any sort of 'lip'.

There is a friction setting for the collider that is -supposed- to fix most of that... only it doesn't work as advertised; even when set to zero friction the collider still exhibits friction and loves to snag on things.


Sadly, if we go with the force-based solution, that is likely exactly what will be done.  It works okay, unless you come down hard off of a jump or something and briefly bottom out the suspension... then weird stuff happens.

Link to comment
Share on other sites

14 hours ago, Shadowmage said:

unless you come down hard off of a jump or something and briefly bottom out the suspension

Idea, and not sure if it's possible, or even practical:

What if you set the suspension up with the equivalent of progressive rate springs?  The idea being that to briefly bottom out the suspension would require so much force it'd shear the wheel off of the craft instead.  So the idea would be that at most normal weights and loads, the spring force would be minimal, just enough to give it suspension, but the closer you get to full compression, the higher the spring's force would be, pushing against the forces trying to smash the bump stops.  End result would be, if you set the upper limits aggressively enough, an appearance of 'bottoming out' (hitting the maximum compression limit for the current amount of weight against the force applied to the sprin, versus actually running out of suspension travel), and wheels that still work.

As said, not sure if it's possible, practical, or whether you guys have a better idea in mind.  I just think of strange things at times.

Link to comment
Share on other sites

9 hours ago, Madrias said:

Idea, and not sure if it's possible, or even practical:

What if you set the suspension up with the equivalent of progressive rate springs?  The idea being that to briefly bottom out the suspension would require so much force it'd shear the wheel off of the craft instead.  So the idea would be that at most normal weights and loads, the spring force would be minimal, just enough to give it suspension, but the closer you get to full compression, the higher the spring's force would be, pushing against the forces trying to smash the bump stops.  End result would be, if you set the upper limits aggressively enough, an appearance of 'bottoming out' (hitting the maximum compression limit for the current amount of weight against the force applied to the sprin, versus actually running out of suspension travel), and wheels that still work.

As said, not sure if it's possible, practical, or whether you guys have a better idea in mind.  I just think of strange things at times.

In an ... analogue?.. world, yes, that would work.

Sadly, we have to use discrete time steps, and the problem with variable spring response is that the difference in compression between frames can cause such a large difference in the spring output that you end up with oscillations, or worse, launching things into orbit.  Might even work acceptably if we could crank the simulation frequency up to 1000hz or so, but that is not really an option if we want real-time physics for anything beyond a single part.

So, not a bad idea, merely one that won't work very well with the constraints in place in video game physics.

However, I might be able to use a much slower response rate on the spring value when it is detected to be at bump-stop -- slowly increase the spring rate until it lifts up a bit.

Link to comment
Share on other sites

I keep forgetting that things that work in an analogue fashion don't always translate well to what limitations you have to work with.

What I do is come up with crazy ideas and hope they're practical.  If it spawns something useful, I take that as a win in my book.

Link to comment
Share on other sites

5 minutes ago, Madrias said:

I keep forgetting that things that work in an analogue fashion don't always translate well to what limitations you have to work with.

What I do is come up with crazy ideas and hope they're practical.  If it spawns something useful, I take that as a win in my book.

No worries, never know when you'll hit gold.

Actually had someone suggest an off-the wall solution to me for fixing the 'sticky friction' problem for the force-based suspension setup -- a solution that looks like it will probably work out.

Also never know when your crazy ideas will spawn further crazy ideas in the head of whomever is reading them.  Had that a few times that resulted in new features or solutions to problems that nobody was expecting.

Link to comment
Share on other sites

Right.... overuse of debug messages to the log reveals that the anchors are created successfully in the correct position, though they are not visible... I can't figure out why. Presumably something to do with shaders, though I've run out of energy to fight with KSP to figure out how to apply a KSP shader - bla, bla, bla.

The rotation of the anchors is set the same as the wheel object every frame, and in any case, the angular drives are set to free, meaning the cannot impart any torque back to the connected object.

I'm bored, frustrated with something that clearly doesn't want to be for a game I don't play any more, and about to give up.

Link to comment
Share on other sites

12 minutes ago, lo-fi said:

Right.... overuse of debug messages to the log reveals that the anchors are created successfully in the correct position, though they are not visible... I can't figure out why. Presumably something to do with shaders, though I've run out of energy to fight with KSP to figure out how to apply a KSP shader - bla, bla, bla.

The rotation of the anchors is set the same as the wheel object every frame, and in any case, the angular drives are set to free, meaning the cannot impart any torque back to the connected object.

I'm bored, frustrated with something that clearly doesn't want to be for a game I don't play any more, and about to give up.

Hmm.. that is unfortunate on the anchors.  Yeah, trying to debug the stuff in KSP is more than a bit of a headache.  Sadly I'm out of ideas for ways to help with the joint based solution; for some reason they still don't get along with me even in Unity versions where they work properly.
 

However I -think- I've found solutions to most of the problems that the force-based suspension setup was encountering.  Haven't been able to put it all together for testing yet, but may be able to get something usable next time I can sit down and work on it.  So there is perhaps some light at the end of the tunnel... it still looks like a pretty long and dark tunnel, but at least there is some end in sight.

If you do feel the need to move on to something else (and I can't blame you for that, I've been more than a bit frustrated when working on the wheels stuff myself), would you have any objections if I were to try and continue KF development through a fork?

Link to comment
Share on other sites

Ah ha, I finally managed to make some progress. The script gets added to the gameObject where the wheel collider is:

 

Super hacky, but this is what I'm using.

	using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using UnityEngine;
	namespace KerbalFoundries
{
    public class WCReplacer : PartModule
	    {
        public override void OnStart(PartModule.StartState state)
        {
            base.OnStart(state);
            if (HighLogic.LoadedSceneIsFlight)
            {
                StartCoroutine(WaitForFixed());
            }
        }
	        IEnumerator WaitForFixed()
        {
            print("WCR waiting for fixedupdate1");
            yield return new WaitForFixedUpdate();
            print("WCR waiting for fixedupdate2");
            yield return new WaitForFixedUpdate();
            print("WCR waiting for fixedupdate1");
            yield return new WaitForFixedUpdate();
            print("WCR waiting for fixedupdate2");
            yield return new WaitForFixedUpdate();
            print("WCR waiting for fixedupdate1");
            yield return new WaitForFixedUpdate();
            print("WCR waiting for fixedupdate2");
            yield return new WaitForFixedUpdate();
            print("WCR Fixing colliders");
            foreach (WheelCollider WC in this.part.GetComponentsInChildren<WheelCollider>())
            {
                print("WCR Found collider");
                print(WC.gameObject.name);
                SLWheelCollider SLW = WC.gameObject.AddComponent<SLWheelCollider>();
                Destroy(WC);
            }
            yield return null;
        }       
    }
}
	
Edited by lo-fi
Link to comment
Share on other sites

2 hours ago, lo-fi said:

Honestly, please do what you like. I'm sick of this.

It's downright sickening to think of how well this worked in 1.0.5 and how much the new Unity update borked everything up. I'm sorry lo-fi. It's obvious this has been a taxing journey.

Link to comment
Share on other sites

A comedy of errors... 

Nvidia messed up the wheel colliders 

Unity carried that forward 

Squad chose to upgrade knowing wheels weren't fit for much 

Weve been paying the price ever since. I'm tired of fighting with it, it isn't fun. 

Link to comment
Share on other sites

4 hours ago, lo-fi said:

Weve been paying the price ever since. I'm tired of fighting with it, it isn't fun. 

Take a break man , don't want to get burned out on something that is supposed to be fun. Buy you a beer over the internet if I could :)

Link to comment
Share on other sites

4 hours ago, lo-fi said:

A comedy of errors... 

Nvidia messed up the wheel colliders 

Unity carried that forward 

Squad chose to upgrade knowing wheels weren't fit for much 

Weve been paying the price ever since. I'm tired of fighting with it, it isn't fun. 

 

 

The wheels and tracks from your mod were the best we had by far.

 

I hope at some point you will find the will to "play" with them again. If not, you did way more then most, thank you.

Link to comment
Share on other sites

i see ya getting a bit fed up lads with how its going.....chin up....youll deffo be getting beer off of me, ifu can work this out.....im sure you can do it \o/

this is the only mod ive never been able to use, but always wanted the most. lol typical

as @gomker says - take a break fellas

Link to comment
Share on other sites

5 hours ago, lo-fi said:

A comedy of errors...

Hey, feeling your pain, the moving, wobbly goalposts aren't much fun right now i know. Ah fun yes i remember that wasn't that 76?  :)

Anyway before you run screaming into the night,  tis the season for it,   those wheel direction indicators you had on one of the KF releases, are/were they a code thing or a unity wrinkle/tag you'd discovered?, could really do with some for removing/solving an irritating recurring mod issue, that is an indicator that displays  in the VAB SPH  but not once launched.

Cheers,  my advice,  go get your hands dirty it'll make you feel better, hit some stuff with hammers etc,  and much good luck

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...