3D Gauges

Hi!

On our Polish forum trying to create a script that will handle the tachometer indicator. The script engine speed of rotation is very simple, but the problems start when it inclined at an angle. Indicatnor is not behaving like texture without views.ini added. Do you have any ideas on how to bend it correctly because we are over ideas :-P

Skybh used in the Renault Laguna, but just like us indicator are flat.

This is Elektryk`s script:
Code:
rcar $car = get scriptowner car
float $rpm=0

rcarmodel $wskazowka = get generic model 8 of $car
set $wskazowka scriptcontrolled 1

while 1
{
$rpm=get $car rpm
if $rpm > -5
{
set $wskazowka rotation float[3]{0,0,$rpm/2000}
  set $wskazowka position float[3]{0,0,0}
}


  interrupt
}
 
Should just be able to set one of the other rotation angles to a constant if I understand the problem right, eg. float[3]{0, 0.2, $rpm/2000}. I don't know offhand whether that works completely though, not sure what kind of rotation vector the scripts use.
 
Yes, this works, but it gives the same effect as turning the model in ZModeler. Indicator moves all the time axis, and the model is only tilted. We want to turn the axis on which the indicator moves, and not the model itself.
 
Ah yeah, gonna have to do trigonometry then, something like
$anglez = $rpm/2000
$anglex = 0.2 * sin $anglez
$angley = 0.2 * cos $anglez
float[3]{$anglex, $angley, $anglez}

I don't have an object set up to test this though so can't say I have the code written correctly. I remember having trouble with multiple operations per line of code but not sure in what way.


It's a yaw-pitch-roll system afaik so you might be able to look up how to do rotation compositions (ie. first a pitch of 0.2 radians, then a roll of $rpm/2000)
 
Last edited:
Humm i've tried to that do (inclined needles). But since the rotation point of the model should be placed on car's CG.. If you move you cg, the rotation won't stay ok :(
(I hope you understand what i mean)
For exemple just change CG location of car with opening doors, and see the result lol
 

Latest News

Online or Offline racing?

  • 100% online racing

    Votes: 72 7.4%
  • 75% online 25% offline

    Votes: 100 10.3%
  • 50% online 50% offline

    Votes: 141 14.6%
  • 25% online 75% offline

    Votes: 266 27.5%
  • 100% offline racing

    Votes: 385 39.8%
  • Something else, explain in comment

    Votes: 4 0.4%
Back
Top