Hinge Scripting?

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

Hinge Scripting?

Postby mold999 » Thu Feb 07, 2013 12:31 am

Hello,

I was wondering if there is any way to edit a hinge's properties, without using scene.my.* variables. I mean, if I have a circle with a hinge, and a box hits it, if I can edit the properties of the hinge. I'm not sure if this is possible, but I know that you can edit the geometry a thruster is attached to, and I was wondering if you could edit information of a hinge.

Thanks,

~~mold999
Phundementalism?

Ain't nobody got
thyme fo dat.
User avatar
mold999
 
Posts: 225
Joined: Sun Jan 02, 2011 1:35 am
Location: [176436, 3763234]

Re: Hinge Scripting?

Postby Kilinich » Thu Feb 07, 2013 9:01 am

Yes, it's possible, you could find a lot of examples in my scenes (hinge - ratchet, damper, torsion).

Key functions here is scene.entityByGeomID() and (readable(owner)).geom0 , geom1 for hinge.
So you can add some property to circle like _wasCollision = false and read it from hinge to adjust something:
_circeCollide = {(scene.entityByGeomID((readable(owner)).geom0))._wasCollision}
You should enter that code in hinge's script menu window (editbox on the top).

p.s. You need to look which is .geom0 and which .geom1 for hinge.
p.p.s Sometimes you need to save-load scene after such code change, bug, reported, will fix (or already fixed in 2.1, I'm not sure).
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: Hinge Scripting?

Postby Don Carnage » Mon Feb 18, 2013 1:35 pm

Hello!

I am starting yet. I can solve the problems mechanically only.
How I can an engine different revs to order to keys?
So: key1=50rpm, key2=100rpm ...

Thank you!
Don Carnage
 
Posts: 3
Joined: Mon Feb 18, 2013 1:33 pm

Re: Hinge Scripting?

Postby Kilinich » Mon Feb 18, 2013 2:33 pm

Don Carnage wrote:Hello!

I am starting yet. I can solve the problems mechanically only.
How I can an engine different revs to order to keys?
So: key1=50rpm, key2=100rpm ...


You could make 2 engines:
geom1 - motor1 - geom2 - motor2 - geom3

motor2 with auto-brake (+inf power) and key-controlled, it adds some rpm to system on key press or key toggle.
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: Hinge Scripting?

Postby Don Carnage » Mon Feb 18, 2013 3:50 pm

Thanks!

Shall I drive a cogwheel with more smaller cogwheels for example? Does the emphasis of one of the engines not stop the other engine?
Don Carnage
 
Posts: 3
Joined: Mon Feb 18, 2013 1:33 pm

Re: Hinge Scripting?

Postby jon_joy_1999 » Mon Feb 18, 2013 9:26 pm

no,
geometry1 is connected to motor1;
motor1 is connected to geometry 2;
geometry2 is connected to motor2;
motor2 is connected to geometry3;

essentially you have the output shaft of motor1 connected to the housing(geometry2) of motor2, with the final output being geometry3
Image
BSrac = BoincStats recent average credit
I'd rather be network computing.
jon_joy_1999
 
Posts: 233
Joined: Fri Dec 09, 2011 12:51 am

Re: Hinge Scripting?

Postby Don Carnage » Wed Feb 20, 2013 12:12 am

Thanks!
I try to do it so.
how can I solve it by a script? (an engine, with more eligible revs)
I would like to learn it. :)

thank you for the help!
Don Carnage
 
Posts: 3
Joined: Mon Feb 18, 2013 1:33 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests