Jump to content

Speedmeter clock


Tockra

Recommended Posts

Hi guys,

i want know, how i can make a speedometer (clock). And how can i get the currently moving speed?

I know, that i can download a resource for it already but i want to make my own...

download and look how it's done .. you will do it same way anyway..

Link to comment
Hi guys,

i want know, how i can make a speedometer (clock). And how can i get the currently moving speed?

I know, that i can download a resource for it already but i want to make my own...

download and look how it's done .. you will do it same way anyway..

Yes i know but I am inclined to copy parts ^^

And i need a little instruction

Link to comment

You get speed with getElementVelocity. This function returns 3 values (x, y and z) which indicate speed on each axis. If you want to calculate actual speed, you have to

1. Multiply these 3 values by themselves

2. Add them new values up

3. Square root the value you get from adding the new 3 values

4. Multiply new value by 100 or 160 to get actual speed

You can also use getElementPosition and getDistanceBetweenPoints3D to get the distance you travelled between last and current frame (onClientRender calls). I find it cleaner and quicker to use the first method.

So, like varez said, simpler would be to copy 2 functions from speedometer resource which do exactly what I explained here.

Link to comment
You get speed with getElementVelocity. This function returns 3 values (x, y and z) which indicate speed on each axis. If you want to calculate actual speed, you have to

1. Multiply these 3 values by themselves

2. Add them new values up

3. Square root the value you get from adding the new 3 values

4. Multiply new value by 100 or 160 to get actual speed

You can also use getElementPosition and getDistanceBetweenPoints3D to get the distance you travelled between last and current frame (onClientRender calls). I find it cleaner and quicker to use the first method.

So, like varez said, simpler would be to copy 2 functions from speedometer resource which do exactly what I explained here.

Thank you...

I have now a idea how i can count the actual axis, but for it i must order the indicator at regular intervals but i dont know how i can make thats. I know only, that i can set them with the gui editor, but so i cant order it in regular intervals...

Link to comment
4. Multiply new value by 100 or 160 to get actual speed

Yes. This values 100 or sth else is the scale of the speed relativity. You have to define world units to obtain this parameter, for example, for yards it takes about 164, for meters about 180. Higher value returns higher speed. Or You can also take this value from your head, withuot any scaling. :P

And, of course, this first method is better. The second one gives strange vibrations taken from 'onClientRender' events.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...