Jump to content

WheelCollider SuspensionSpring settings do not instantly take effect in flight.


lo-fi

Recommended Posts

I've been working with WheelColliders for a while now and got the hang of setting things dynamically quite well. If I set the Spring or Damper property in VAB/SPH it is carried into flight perfectly. However, if I change the values in flight they either don't take effect or there's about 30 secs delay. Setting _anything_ else (grip, distance etc.) in flight takes effect instantly.

I have a nasty feeling this is something to do with stuff going on in ModuleWheel, but I'm stumped. Calling the spring setting to the log shows it's been changed to the new value; KSP just seems to ignore it for a good while :/



[KSPField(isPersistant = true, guiActive = true, guiActiveEditor = true, guiName = "Strength"), UI_FloatRange(minValue = 0, maxValue = 3.00f, stepIncrement = 0.2f)]
public float SpringRate;


public WheelCollider mywc;
public JointSpring thisSpring;

foreach (WheelCollider wc in this.part.GetComponentsInChildren<WheelCollider>())
{
thisSpring = wc.suspensionSpring;
thisSpring.spring = SpringRate;
wc.suspensionSpring = thisSpring;
print(wc.suspensionSpring.spring);
}

I've tried lots of variations, not one method is more effective than the other. Even added a line in OnFixedUpdate that prints the current spring value - always reported correctly. Somethin' funny going on around here!

Can anyone shed any light? You guys have been brilliant setting me on the right path so far, though I appreciate this one may be hard to narrow down. As always, thanks in advance.

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...