Script angle please help

About advanced scenes, and the Thyme scripting language used in Algodoo.

Script angle please help

Postby kakaman » Thu Jan 16, 2014 8:31 pm

Hello everyone I need a script that detect the angular velocity of a wheel someone could help me with the script that i need :)?
kakaman
 
Posts: 1
Joined: Thu Jan 16, 2014 8:25 pm

Re: Script angle please help

Postby electronicboy » Thu Jan 16, 2014 9:17 pm

You can grab an geometries angular velocity with the angvel variable, so you should be able to place that onto a variable as needed.

e.g. scene.my.speed = e.geom.angvel; (using a laser). I'm pretty sure you could also grab the code from the "update" box with:

scene.my.speed = entity.angvel; however I can't guarantee this will work due to the time I actually spend on algodoo now a days.
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: Script angle please help

Postby Xray » Sat Jan 18, 2014 9:06 am

electronicboy wrote: e.g. scene.my.speed = e.geom.angvel; (using a laser). I'm pretty sure you could also grab the code from the "update" box with:

scene.my.speed = entity.angvel; however I can't guarantee this will work due to the time I actually spend on algodoo now a days.


Yes, that will in fact work. You don't need "entity" unless your code gets complex. So, for simple scripts, scene.my.speed = angvel will work just fine. Keep in mind that the value produced in angvel is in units of rads/sec. So, if you wanted RPM or some other unit, then you would need to do a little conversion math on the value.
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests