Jump to content

Help with wheel sliding


Recommended Posts

Hi all,

I am trying to sort through a problem I'm having with custom wheels in KSP 1.2.1. When I have the brakes on, the rover tends to slide across the ground like so:

jYjWWIR.gif

This happens even with traction and brakes set to max:

lOQtTYq.png

Here's the configuration I'm using for the wheel, it's pretty much the same as the stock M1 wheel:

Spoiler

    MODULE
    {
        name = ModuleWheelBase
        
        wheelColliderTransformName = wheelCollider        
        wheelTransformName = WheelRotation
        
        wheelType = MOTORIZED
        frictionMultiplier = 0.0

        // setting this to true will override the radius and center parameters
        FitWheelColliderToMesh = False        
        radius = 0.285
        center = 0,0,0
        mass = 0.25
        groundHeightOffset = 0
                
        TooltipTitle = Rover Wheel
        TooltipPrimaryField = Motorized
    }
    MODULE
    {
        name = ModuleWheelSuspension
        baseModuleIndex = 0
        suspensionTransformName = suspensionTraverse
        
        suspensionDistance = 0.2
        targetPosition = 0.5            
        springRatio = 7.0
        damperRatio = 7.0
    }    
    MODULE
    {
        name = ModuleWheelSteering
        baseModuleIndex = 0
        
        caliperTransformName = trackSteering
        
        steeringResponse = 2
        steeringCurve
        {
            key = 0 20
            key = 10 9
            key = 30 3.0
        }
    }
    MODULE
    {
        name = ModuleWheelMotor
        baseModuleIndex = 0
        
        wheelSpeedMax = 42
        driveResponse = 10
        tractionControlScale = 0.0
    
        torqueCurve
        {
            key = 0 2.0 0 0
            key = 10  1.4 0
            key = 30 0.5 0 0
            key = 34 0 0 0
        }
        
        RESOURCE
        {
            name = ElectricCharge
            rate = 2.0
        }        
        idleDrain = 0.0
    }
    MODULE
    {
        name = ModuleWheelBrakes
        baseModuleIndex = 0
        
        maxBrakeTorque = 3
        brakeResponse = 2
    }

I'm pretty much shooting in the dark on this, so one of the things I did is download and install  DebugStuff by @sarbian

When I hid everything except the wheel colliders, I noticed some differences between the stock wheels and my custom wheels. In this image, you can see the stock wheels. Notice the wheel collider? It's red for some reason, and fairly small. Stock wheels don't share the same problem as my custom wheels do.

xpc0gFM.png

My wheel colliders are green and much larger despite what I set in Unity:

4s6pMLx.png

I'm guessing, because there's so little information on wheels in KSP 1.2.1, but maybe the wheel collider on my custom wheel is setup incorrectly. But if so, I don't know how it should be set up. Using @sarbian's Blender scripts, I found the values for the stock M1 wheel:

Spoiler

Wheel {
    name = roverWheel1.WheelCollider
    mass = 5.0
    radius = 0.3779999911785126
    suspensionDistance = 0.0
    center = 0.0, 0.0, 0.0
    suspensionSpring {
        spring = 3.0
        damper = 0.5
        targetPosition = 0.05000000074505806
    }

    forwardFriction {
        extremumSlip = 0.4000000059604645
        extremumValue = 1.0
        asymptoteSlip = 0.800000011920929
        asymptoteValue = 0.5
        stiffness = 1.0
    }

    sidewaysFriction {
        extremumSlip = 0.20000000298023224
        extremumValue = 1.0
        asymptoteSlip = 0.5
        asymptoteValue = 0.75
        stiffness = 1.0
    }

}

In Unity, my wheels are set up similarly:

pDRzlNP.png

You can see that my collider is about the same size as the wheel. I've tried making the collider smaller but the wheel sinks into the ground. I'm not sure if @zitronen has had similar problems as I do with his Wheels Collection mod, but hopefully there's enough info here that might shed some light on the problem. And hey, Wheels Collection looks pretty neat. :)

That's about all the info I have, is there something I'm missing? Thanks for your help! :)

Edited by Angel-125
Link to comment
Share on other sites

I was pretty sure that the unity wheel collider is only used to position the actual collider used in KSP wheel module, i.e. the parameters in unity has no effect, all the important stuff are defined in the cfg file. But you might want to try setting "suspension distance" to the correct value in unity instead of 0. Don't think it'll do much though...

Also what's " frictionMultiplier = 0.0 " and " tractionControlScale = 0.0 "? Those are not in my cfg files. Have you tried removing them?

Link to comment
Share on other sites

Hi I've noticed similar odd sliding behaviour from my modded wheels, not so much at launch, in fact they don't slip at all at launch, usually the slippage starts after in impact of some sort, and I've noticed certain types of layout see more susceptible than other,  straight up and down type suspension with no frills , TR2L style is pretty much hassle free, but wishbone suspension is the biggest culprit at present, Ive not been able to pin down the why either.

I don't think that visible collider can be right though as surely if it was the wheels would be hovering inches above the ground?  Re the cfg, i always set my cfg values to the same as the unity values and general that's worked out well enough.

Link to comment
Share on other sites

1 hour ago, Stone Blue said:

Not sure if this is helpful or not, but it seems @Shadowmage may have made some progress with wheel colliders and the sliding bug...??
 

 

To be fair, I'm using a completely custom written force-based Wheel Collider solution (suspension, friction), and my findings and advances are not really applicable to part using the stock wheel system or the Unity5 WheelCollider.

But... it should be publicly available soon, and then everyone can have working, easy-to-setup wheels!  (Seriously, they are easier to setup than the old U4 wheel colliders, and much more reliable and predictable as far as friction behavior).

19 hours ago, Angel-125 said:

[snip]

The red you are seeing in the hierarchy view is actually what stock calls a 'collisionEnhancer'.  It is a real collider that is used to prevent punchthrough, and hide some of the terrible artifacts caused by the simplistic raycasting used by the wheels.

As far as the sliding goes -- try reducing your damper / lowering damping ratio, setting the target position lower on the compression, and/or lowering your spring value.  Those are generally the settings that can cause jitter/sliding that I've found in my playing with Unity physics.

Link to comment
Share on other sites

@Shadowmage Oh yeah excrements good catch. Damping ratio of 7.0 is way too high. I think in the stock wheel module damping ratio of 1.0 = critically damped, < 1.0 = under damped and >1.0 = over damped. I think most real world vehicles are under damped. Lower damping means soft and bouncy e.g. for passenger cars, higher damping means rigid and harsh e.g. for racing. I think reasonable values are around 0.2-1.2 ish, start at 1.0, and tune for the desired effect. Spring ratio of 7.0 is fine from experience. I'm not sure what real world value spring ratio refers to, I think the devs mentioned something about natural frequency, maybe in radians/s or something. Basically increase it for stiffer spring, and decrease for softer spring.

I find the new wheel module much easier to tune, although I did have lot of issues figuring out rotation axes.

 

Edit:

Also that huge green spherical colider, something is really wrong with that, since it's not showing up in your unity screen shot. Do you have a spherical colider? If you do its radius should be set to be less than that of the actual wheel, it's only there to prevent the wheel noclipping through stuff it hits not for actually touching the ground.

Edited by zitronen
Link to comment
Share on other sites

On 11/24/2016 at 4:09 PM, zitronen said:

@Shadowmage Oh yeah excrements good catch. Damping ratio of 7.0 is way too high. I think in the stock wheel module damping ratio of 1.0 = critically damped, < 1.0 = under damped and >1.0 = over damped. I think most real world vehicles are under damped. Lower damping means soft and bouncy e.g. for passenger cars, higher damping means rigid and harsh e.g. for racing. I think reasonable values are around 0.2-1.2 ish, start at 1.0, and tune for the desired effect. Spring ratio of 7.0 is fine from experience. I'm not sure what real world value spring ratio refers to, I think the devs mentioned something about natural frequency, maybe in radians/s or something. Basically increase it for stiffer spring, and decrease for softer spring.

I find the new wheel module much easier to tune, although I did have lot of issues figuring out rotation axes.

 

Edit:

Also that huge green spherical colider, something is really wrong with that, since it's not showing up in your unity screen shot. Do you have a spherical colider? If you do its radius should be set to be less than that of the actual wheel, it's only there to prevent the wheel noclipping through stuff it hits not for actually touching the ground.

Thanks guys, I lowered the dampingRatio and got rid of the frictionMultiplier, then tried the new settings. It drives nicer but still has the same issue. One thing I noticed is that if the wheels are close together (see original image), the sliding happens. If I just have wheels in the front and the back, then the rover doesn't slip (well it slips a small amount). The further the distance between the wheels, the less slippage I'm seeing. So there seems to be an interaction problem.

For the wheel collider, here is what I have:

cNyq5Fa.png

I'm using a capsule collider in this case, and it is on wheelCollidersIgnore. Is there a collisionEnhancer layer?

Thanks again for your help. :)

Link to comment
Share on other sites

@Angel-125 @Shadowmage @zitronen   guys you are great.

 

Can I bother you with my questions for custom wheels settings in unity ?  

Btw @Shadowmage looking forward for this new wheel plugin from you. Hope you will do some tutorial video for it and mainly for setting the wheels in Unity.

 

Thank you guys. I can finally continue working on my model. As those not working custom wheels were the part that was holding me back for such a long time...

Link to comment
Share on other sites

13 hours ago, Angel-125 said:

Is there a collisionEnhancer layer?

Hi , the collision enhancers are usually  on the Layer 26 WheelCollidersIgnore,  well at least that's where all mine have always been. :)

Perhaps a point of interest, for the wheels in your images I'd be tempted to have everything except the main collision enhancer aligned to the extreme outer edge of the outer wheel,  this give for a much more stable platform and removes the outer wheel clipping through terrain issues that can be seen with a centered colliders, like those on stock landing gear.

Link to comment
Share on other sites

6 hours ago, SpannerMonkey(smce) said:

Hi , the collision enhancers are usually  on the Layer 26 WheelCollidersIgnore,  well at least that's where all mine have always been. :)

Perhaps a point of interest, for the wheels in your images I'd be tempted to have everything except the main collision enhancer aligned to the extreme outer edge of the outer wheel,  this give for a much more stable platform and removes the outer wheel clipping through terrain issues that can be seen with a centered colliders, like those on stock landing gear.

Hm, good point! I'll play with the wheel collider and collision enhancer and see what happens. Thanks for the suggestion. :)

Link to comment
Share on other sites

25 minutes ago, zitronen said:

Mine are also on "WheelCollidersIgnore". Is your wheel collider in the layer "wheelcoliders"? Did you figure out what that huge green thing is in the first picture?

AHA! My wheelCollider wasn't set on the wheelColliders layer! Setting it to wheelColliders did the trick! Of all the stupid things... I still haven't figured out what the giant spheres are, but at least the wheels don't appear to slip. Thanks again, I'll report in if there's more trouble. :)

Link to comment
Share on other sites

52 minutes ago, zitronen said:

huh... I guess the wheel collider is interacting with something it shouldn't (maybe the collision enhancer) because it's not in the correct layer?

Yeah, could be, but I don't rightly know. Wheels are still an arcane science to me. Anyway, it seems the slippage is for the most part solved, thanks again. :)

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...