Jump to content
Sign in to follow this  
Aqu

Nonlinear indicator

Recommended Posts

Like the topic says, is it possible to make nonlinear indicators?

I should make a speed indicator, but in real life it was heavily non-linear, meaning that the speed change from 0kph to 100kph made the needle move much more than what it made at 600-700kph. I would be happy if I could make it even piecewise linear as I tryed to divide it to ranges 0-100,100-200,200-... and then using script to animate it. But it seems I cannot change the animation phase anywhere except 0 or 1 (with the animate command).

Share this post


Link to post
Share on other sites

Assuming you have a vehicle with maximal speed of 60 km/h (16.67 m/s) you could split the animation in for example 3 linear parts to simulate nonlinear behaviour:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class IndicatorSpeed1: Rotation

{

source="speed";

selection="ukaz_rychlo";

axis="osa_rychlo";

memory=0;

minValue=0;

maxValue=16.67/3;

angle0=0;

angle1=rad -240;

};

class IndicatorSpeed2: IndicatorSpeed1

{

minValue = 16.67/3;

maxValue = 16.67*2/3;

angle0=rad -130;

angle1=rad -200;

};

class IndicatorSpeed3: IndicatorSpeed1

{

minValue = 16.67*2/3;

maxValue = 16.67;

angle0= rad -200;

angle1= rad -240;

};

I didn't test it though.

Share this post


Link to post
Share on other sites

Good suggestion, but it doesn't seem to work. Those indicator classes fight against each other for the same needle. Even if the speed is outside the range of a class the class wants to place it constantly at the boundary place, so it seems. The result is erratic moving and constant shaking.  confused_o.gif

Share this post


Link to post
Share on other sites

Weird... confused_o.gif

We are using the same system for the starting SCUD rocket in CWR mod. Only difference is the animation type which is "direct":

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class ScudRaketaAcc_1: ScudRaketaUp

{

minValue=1;

maxValue=1.090909;

axisDir[]={0,1,0};

axisPos[]={0,0,0};

axisOffset=0.5;

angle=0;

};

class ScudRaketaAcc_2: ScudRaketaAcc_1

{

minValue=1.090909;

maxValue=1.181818;

axisOffset=1;

};

class ScudRaketaAcc_3: ScudRaketaAcc_1

{

minValue=1.181818;

maxValue=1.272727;

axisOffset=2;

};

class ScudRaketaAcc_4: ScudRaketaAcc_1

{

minValue=1.272727;

maxValue=1.363636;

axisOffset=4;

};

class ScudRaketaAcc_5: ScudRaketaAcc_1

{

minValue=1.363636;

maxValue=1.454545;

axisOffset=8;

};

class ScudRaketaAcc_6: ScudRaketaAcc_1

{

minValue=1.454545;

maxValue=1.545455;

axisOffset=16;

};

class ScudRaketaAcc_7: ScudRaketaAcc_1

{

minValue=1.545455;

maxValue=1.636364;

axisOffset=32;

};

class ScudRaketaAcc_8: ScudRaketaAcc_1

{

minValue=1.636364;

maxValue=1.727273;

axisOffset=48;

};

class ScudRaketaAcc_9: ScudRaketaAcc_1

{

minValue=1.727273;

maxValue=1.818182;

axisOffset=64;

};

class ScudRaketaAcc_10: ScudRaketaAcc_1

{

minValue=1.818182;

maxValue=1.909091;

axisOffset=80;

};

class ScudRaketaAcc_11: ScudRaketaAcc_1

{

minValue=1.909091;

maxValue=2;

axisOffset=96;

};

Share this post


Link to post
Share on other sites

I have looked too much of the config and it won't surprise me if there is some dumb mistake. I'm not even sure anymore is the value the speed source gives in m/s, km/h or 0..1 relative to the top speed. Tryed all of those, but all work wierdly in some way.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class IndicatorSpeed100 : Rotation

{

  type = "rotationZ";

  source="speed";

  sourceAddress="loop";

  selection="needle_speed";

  axis="axis_ind_speed";

  memory=0;

  angle0=0;

  angle1="rad 40";

  minValue=0;

  maxValue=160.9344;

};

class IndicatorSpeed150 : IndicatorSpeed100

{

  angle0="rad 40";

  angle1="rad 90";

  minValue=160.9344;

  maxValue=241.4016; // 150mph

};

class IndicatorSpeed200 : IndicatorSpeed100

{

  angle0="rad 90";

  angle1="rad 135";

  minValue=241.4016;

  maxValue=321.8688; // 200mph

};

 class IndicatorSpeed250 : IndicatorSpeed100

{

  angle0="rad 135";

  angle1="rad 190";

  minValue=321.8688;

  maxValue=402.336; // 250mph

};

class IndicatorSpeed300 : IndicatorSpeed100

{

  angle0="rad 190";

  angle1="rad 235";

  minValue=402.336;

  maxValue=482.8032; // 300mph

};

class IndicatorSpeed400 : IndicatorSpeed100

{

  angle0="rad 235";

  angle1="rad 265";

  minValue=482.8032;

  maxValue=643.7376; // 400mph

};

class IndicatorSpeed700 : IndicatorSpeed100

{

  angle0="rad 265";

  angle1="rad 340";

  minValue=643.737;

  maxValue=1126.5408; // 700mph

};

This particular example works without shaking, but starts from 300mph (when speed=0). It seems almost like it is showing only the class IndicatorSpeed400, but not correct.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×