Ratchet 2.0

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

Ratchet 2.0

Postby Kilinich » Tue Dec 27, 2011 1:30 pm

Another example of readable possibilities for scripting hinges/motors.
Code for ratchet (auto-brake is on):

Code: Select all
autoBrake = true;
motorTorque = {(readable(Scene.entityByGeomID((readable(owner)).geom0))).angvel > 0 ? 0 : +inf}


Rating: rated 5.5
Filesize: 23.64 kB
Comments: 3
Ratings: 2
download


p.s. Again - undo kills scripts in 2.0.1 hope it will be fixed.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Ratchet 2.0

Postby SodaJerk » Fri Dec 21, 2012 11:09 am

To change the direction in which the axle is able to turn change the > to < it took me a while to notice this.

Love this script. I think it should be an axle option.
SodaJerk
 
Posts: 8
Joined: Mon Feb 08, 2010 4:40 am

Re: Ratchet 2.0

Postby Kilinich » Fri Dec 21, 2012 11:19 am

For correct work it needs second geom angvel check.

BTW, in 2.0.2 there is no need in "double" readable usage.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Ratchet 2.0

Postby SodaJerk » Fri Dec 21, 2012 1:05 pm

What do you mean by "second geom angvel check"? I'm new to Thyme scripting, can you please post the code. Thanks.
SodaJerk
 
Posts: 8
Joined: Mon Feb 08, 2010 4:40 am

Re: Ratchet 2.0

Postby Kilinich » Fri Dec 21, 2012 2:43 pm

SodaJerk wrote:What do you mean by "second geom angvel check"? I'm new to Thyme scripting, can you please post the code. Thanks.


Correct calculation is difference between geom0 and geom1 angvel.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests