Browse Search Popular Register Upload Rules User list Login:

screenshot of the scene

Author: MMGISS

Group: Default

Filesize: 22.8 kB

Date added: 2016-12-18

Rating: 5

Downloads: 331

Views: 101

Comments: 2

Ratings: 1

Times favored: 0

Made with: Algodoo v2.1.0


Scene tag

This is a meter
just a meter
only a meter

You can use it without credit
Last edited at 2016/12/19 07:36:16 by MMGISS
Please log in to rate this scene
Similar scenes
Title: Proton Exora Car Test Drive
Rating: 5.625
Filesize: 416.98 kB
Downloads: 805
Comments: 6
Ratings: 2
Date added: 2010/08/28 15:58:20
Made with: Phun
Rating: rated 5.6
Title: SpeedMeter
Rating: 5
Filesize: 30.4 kB
Downloads: 131
Comments: 0
Ratings: 1
Date added: 2018/10/14 16:02:50
Made with: Algodoo v2.1.0
Rating: rated 5
Title: railroad minigame
Rating: 5
Filesize: 366.84 kB
Downloads: 341
Comments: 0
Ratings: 1
Date added: 2014/08/14 22:34:55
Made with: Algodoo v2.1.0
Rating: rated 5
Title: New generation subway car(test car)
Rating: 5
Filesize: 0.55 MB
Downloads: 1056
Comments: 0
Ratings: 1
Date added: 2018/11/16 23:12:27
Made with: Algodoo v2.1.0
Rating: rated 5

You could've written:

text = {math.toInt(math.vec.len(vel)) * 3.6 + " km/h"}

and THAT ONE line does the same than all your script, without any

math.vec.len calculates the module of the vector velocity ((x^2+y^2)^0.5), and math.toInt makes the number an integer (0, -1, 5).

In case you want to work only on one object you can also use _variables, that work just like with the exception that you can only read or write them from the same object where they are declared (you CAN do those things from somewhere else but it's too complex)

For example, you want to declare a variable called _v1, one called _v2 and one called _v3:

First you go to the Script menu and find this box:
Now you have to write the name of the variable (always with a _ at the front!) and the initial value you want to give to it like this

_v1 = 0.0

Hit Enter and the variable will appear. Do the same with the others and now you can rewrite your script in a far more efficient way:

onHitByLaser = (e)=>{_v1 = vel(0); _v2 = vel(1)}
text = {(_v1 ^2 + _v2 ^2)^0.5}
Also if you want your script to be always on you can put it in postStep