3D Gauges

Mari17

10RPM
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
}``````

Stereo

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

Mari17

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

Stereo

3000RPM
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:

skybh

250RPM
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

Mari17

10RPM
Skybh if I understand you correctly, it is enough to racer.ini move_cg change from 1 to 0