API Question Implementing a Key Press/Release to Toggle Surface Friction Coefficients

Thunder Chicken

Fine Threads since 2008
Donator
Joined
Mar 22, 2008
Messages
3,043
Reaction score
1,379
Points
138
Location
Massachusetts
Thanks for your help with this.
I'm trying to get less braking effort, rather than the maximum, but whatever figure I put in SetWheelbrakeLevel() however low, always results in the same effect - maximum braking.
Set SetSurfaceFrictionCoeff(0.0, 0.0), you'll have absolutely no braking at all!

Yes, still get the maximum braking effect even commenting out the whole chabang in clbkPostStep(). :LOL:
Do you have SetMaxWheelbrakeForce() set anywhere? If this is set below the force you would get my multiplying the friction coefficient mu and the vessel weight W I think it should work.
So that's why it's not possible to keep stationary on an incline too, even with brakes applied ?
Yep. There is no way to specify a static friction coefficient in addition to the dynamic coefficient. The static coefficient describes the resistance to initial motion when the object is stationary. Once the object starts to slide, then the dynamic coefficient describes the friction force on a moving object.

IMO Set SetSurfaceFrictionCoeff() should have 4 arguments: mu_static_longitudinal, mu_dynamic_longitudinal, mu_static_lateral, mu_dynamic_lateral. Until it does, holding brakes or avoiding sliding down hills will not be possible. It's especially unfortunate now that there IS vertical terrain relief enabled in Orbiter.
 

JMW

Aspiring Addon Developer
Joined
Aug 5, 2008
Messages
580
Reaction score
40
Points
43
Location
Happy Wherever
Can you confirm that the code execution passes RESETKEY?
Sorry for late reply, got stuck with RL.
Couldn't get it to Break on debugger, but........
Put code thus
Code:
void ShuttlePB::clbkPostStep (double simt, double simdt, double mjd)

{

    if (CommaKey == 1) // Less Wheelbrake left
        {       
                    blevell += 0.03;
                    if (blevell > 1.0) {
                        blevell = 1.0;
                    }
                    SetWheelbrakeLevel(blevell,1, false);
                    
                    }
        if (CommaKey == 0) // Off left
        {    blevell = 0.0;    SetWheelbrakeLevel(blevell,1, false);}   
                
    if (PeriodKey == 1) // Less Wheelbrake right
        {       
    
                    blevelr += 0.03;
                    if (blevelr >1.0) {
                        blevelr =1.0;
                    }
                    SetWheelbrakeLevel(blevelr,2, false);
                    
                    }
        if (PeriodKey == 0) // Off right
        {    blevelr = 0.0;    SetWheelbrakeLevel(blevelr,2, false);}

        sprintf(oapiDebugString(),"Comma L %7.7f:blevell %7.7f:Period R %7.7f:blevelr %7.7f", CommaKey, blevell, PeriodKey, blevelr);
  }    
etc.............
And
Code:
int ShuttlePB::clbkConsumeDirectKey (char *kstate)

{

    if (KEYDOWN (kstate, OAPI_KEY_COMMA)) // Less Wheelbrake left
        
                {
                    RESETKEY (kstate, OAPI_KEY_COMMA);
                    if(CommaKey == 0) CommaKey = 1;
                    }
        else {    CommaKey = 0;}
                    
    if (KEYDOWN (kstate, OAPI_KEY_PERIOD)) // Less Wheelbrake right
                {
                    RESETKEY (kstate, OAPI_KEY_PERIOD);
                    if(PeriodKey == 0) PeriodKey = 1;
                    }
        else {    PeriodKey = 0;}   
    }
return 0;
}

And it works !
I don't know why but sending commands from clbkPostStep() does the trick.
Thanks all. :cheers:
 
Top