Tockra Posted May 12, 2010 Share Posted May 12, 2010 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... Link to comment
dzek (varez) Posted May 12, 2010 Share Posted May 12, 2010 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
Tockra Posted May 12, 2010 Author Share Posted May 12, 2010 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
dzek (varez) Posted May 12, 2010 Share Posted May 12, 2010 hmm, well, i know nothing about it.. when i was in need of getting veh speed (for another script - checking if speed is enough), i just copy few lines from speedometer res. i thought there was no need to reinvent the wheel Link to comment
50p Posted May 12, 2010 Share Posted May 12, 2010 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
Tockra Posted May 13, 2010 Author Share Posted May 13, 2010 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 to1. 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
Salem Posted May 18, 2010 Share Posted May 18, 2010 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. And, of course, this first method is better. The second one gives strange vibrations taken from 'onClientRender' events. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now