Utilising angular velocity of an object to make a tachometer
4 posts • Page 1 of 1
Utilising angular velocity of an object to make a tachometer
Is there any way i can use script to extract the angular velocity of the wheel of a car to display said speed or convert it into a different unit, such as km/h or such? I know the numbers are there, in information, but i don't know how I would turn them into a variable that i can display on a box. Does anyone have any ideas?
- royalblue
- Posts: 14
- Joined: Mon Aug 31, 2009 9:22 pm
Re: Utilising angular velocity of an object to make a tachometer
Yes. Basically it's very easy. Angular velocity is Δα/Δt. So you just have to measure the angle of a geometry and simulation time at two different times and that's it.
For example you have a geometry and put a laser on it that's colliding with a little rectangle that's fixed to the geometry. The laser code is:
There could be mistakes somewhere. I just typed in the code very quickly.
For example you have a geometry and put a laser on it that's colliding with a little rectangle that's fixed to the geometry. The laser code is:
- Code: Select all
(e)=>
{
scene.my.angle2 = math.acos(e.normal(0));
e.normal(1) < 0 ? {scene.my.angle2 = 2*math.pi - scene.my.angle2} : {};
scene.my.angvel = (scene.my.angle2 - scene.my.angle1) / (sim.time - scene.my.time1)
scene.my.angle1 = math.acos(e.normal(0));
e.normal(1) < 0 ? {scene.my.angle1 = 2*math.pi - scene.my.angle1} : {};
scene.my.time1 = sim.time;
}
There could be mistakes somewhere. I just typed in the code very quickly.
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
Re: Utilising angular velocity of an object to make a tachometer
I mean, the program already calculates the speed of the object, why is there no way to just take that number and put it somewhere else
- royalblue
- Posts: 14
- Joined: Mon Aug 31, 2009 9:22 pm
Re: Utilising angular velocity of an object to make a tachometer
hmm yeah that's a good question. but thyme is very simple. maybe it gets expanded in future updates.
But there's a little trick so you can access nearly everything
But there's a little trick so you can access nearly everything
-
KarateBrot - Posts: 825
- Joined: Mon Aug 31, 2009 7:32 pm
- Location: Germany
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest