How to make a Speedometer?
6 posts • Page 1 of 1
How to make a Speedometer?
Ok I've been making alot of improvements with my learning about algoengines. Now I can build, script, tune, and even design my own. I'm actually making my first car powered by a spawn engine and 5-speed transmission, but a speedometer is the only other thing I need.
Now let me be clear first before I ask how; I don't want complicated scripting, or the "proper" way to do it. I already know how I would, it's similar to how I do my tachometer.
First I use a laser, and in "onLaserHit =" I type e.geom.angvel = scene.my.rpm. Then I make the tachometer, and in the hinge for the needle I use scene.my.rpm as bendTarget. Now I figured I'd just do the same exact thing here for the speedometer. I tried using a laser and typing "onLaserHit = (e)=>{ e.geom.vel = scene.my.speed }" and it worked fine. It seems like it's getting that variable now, but when I try to type that into bendTarget it doesn't let me.
Am I just not typing it right? Do you get the velocity some way different than e.geom.vel? Once I figure this out I'll have my first car finished, so please help me out guys
Now let me be clear first before I ask how; I don't want complicated scripting, or the "proper" way to do it. I already know how I would, it's similar to how I do my tachometer.
First I use a laser, and in "onLaserHit =" I type e.geom.angvel = scene.my.rpm. Then I make the tachometer, and in the hinge for the needle I use scene.my.rpm as bendTarget. Now I figured I'd just do the same exact thing here for the speedometer. I tried using a laser and typing "onLaserHit = (e)=>{ e.geom.vel = scene.my.speed }" and it worked fine. It seems like it's getting that variable now, but when I try to type that into bendTarget it doesn't let me.
Am I just not typing it right? Do you get the velocity some way different than e.geom.vel? Once I figure this out I'll have my first car finished, so please help me out guys
- Epic_SkyPilot
- Posts: 12
- Joined: Sun Sep 14, 2014 11:28 pm
Re: How to make a Speedometer?
You need to use math.vec.len(vel) to get velocity as a single number. If you use e.geom.vel or something, it will give you 2 numbers instead. Also, type this into just a normal geom, not a laser that hits a geom, that is attached to your car and moves with it. Now you can use said variable to build a speedo
(/)(°,,,°)(/)
-
pnvv - Posts: 670
- Joined: Tue Aug 26, 2014 11:46 pm
- Location: Disunited States of America
Re: How to make a Speedometer?
Ok I just tried that, but with no luck. I don't really understand. I type math.vec.len(vel) into where on the script menu of my car? And also, when I do type this in correctly, what variable do I then type into the bendTarget on my speedometer?
- Epic_SkyPilot
- Posts: 12
- Joined: Sun Sep 14, 2014 11:28 pm
Re: How to make a Speedometer?
Oh, you have to type in like scene.my.vel = math.vec.len(vel) into it (in postStep) then use scene.my.vel in your speedo.
(/)(°,,,°)(/)
-
pnvv - Posts: 670
- Joined: Tue Aug 26, 2014 11:46 pm
- Location: Disunited States of America
Re: How to make a Speedometer?
Oh ok I got it now. Thanks pnvv, you're extremely helpful
- Epic_SkyPilot
- Posts: 12
- Joined: Sun Sep 14, 2014 11:28 pm
Re: How to make a Speedometer?
i know nothing about algodoo scripting. i know a tiny bit of code from the DOS days.
i wondered, just to get the picture, do u guys only put code in the script box in algodoo or do u also pre-design lines in other software?
i wondered, just to get the picture, do u guys only put code in the script box in algodoo or do u also pre-design lines in other software?
- beamybeams
- Posts: 8
- Joined: Sat Jul 25, 2015 1:20 am
6 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest