Torsion hinge

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

Torsion hinge

Postby Kilinich » Thu Dec 29, 2011 2:34 pm

This can be very useful. Real torsion based on scripted hinge.
No damping handling yet (will implement later), so I use second hinge with brake.

script for hinge:

Code: Select all
_delta = 0;
_constant = 200;
_angle = {
    hinge := readable(owner);
    (readable(Scene.entityByGeomID(hinge.geom1))).angle -
    (readable(Scene.entityByGeomID(hinge.geom0))).angle + owner._delta
};
motorTorque = {owner._angle * owner._constant};
ccw = {owner.motorTorque < 0};
motorSpeed = 10;
motor = true


Rating: rated 5
Filesize: 23.43 kB
Comments: 1
Ratings: 1
download
Last edited by Kilinich on Thu Jan 05, 2012 7:46 pm, edited 2 times in total.
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: Torsion hinge

Postby Kilinich » Fri Dec 30, 2011 9:57 am

Damper addon

Code: Select all
_dampingFactor = 1;
_angvel = {
    hinge := readable(owner);
    angvel := (readable(Scene.entityByGeomID(hinge.geom1))).angvel - (readable(Scene.entityByGeomID(hinge.geom0))).angvel
};
motorTorque = {owner._angvel * owner._dampingFactor * 10};
autoBrake = true


Rating: rated 5
Filesize: 22.84 kB
Comments: 0
Ratings: 1
download
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 1 guest