Modern mouse follow

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

Modern mouse follow

Postby Kilinich » Wed Nov 30, 2011 8:56 am

Ok, next evolution of mouse follow script - no lasers, no scene.my variables.

Script for hinge bendTarget:
Code: Select all
{
    v := app.mousepos - (readable((Scene.entityByGeomID((readable(owner)).geom1)))).pos;
    (v(0) < 0 ? math.pi : 0) - math.atan(v(1) / v(0))
}


It's phunlet-safe but script killed (need to be re-entered) on clone/copy-paste.

Rating: rated 5
Filesize: 23.91 kB
Comments: 4
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

Re: Modern mouse follow

Postby s_noonan » Wed Nov 30, 2011 12:32 pm

I'm using Algodoo beta for Education v2.0.1. Script for hinge bendTarget shows up as NaN. Pasted script in bendTarget, but it turns red and does not stay on closing script window.
s_noonan
 
Posts: 61
Joined: Tue Mar 30, 2010 2:25 am

Re: Modern mouse follow

Postby s_noonan » Wed Nov 30, 2011 12:34 pm

Downloaded again and retried. Now works OK for left car. Does not work every time scene is loaded.
s_noonan
 
Posts: 61
Joined: Tue Mar 30, 2010 2:25 am

Re: Modern mouse follow

Postby Kilinich » Wed Nov 30, 2011 3:31 pm

It's for beta9+
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: Modern mouse follow

Postby s_noonan » Thu Dec 01, 2011 1:03 am

Thanks. Downloaded b10 and now everything works.
s_noonan
 
Posts: 61
Joined: Tue Mar 30, 2010 2:25 am

Re: Modern mouse follow

Postby monstertje3 » Sun Dec 11, 2011 1:27 pm

the code seems to fail in b12,

if you change the - into a + before math.atan, it correctly follows the mouse, but after undo the script needs to be re-entered.
Code: Select all
{
    v := app.mousepos - (readable((Scene.entityByGeomID((readable(owner)).geom1)))).pos;
    (v(0) < 0 ? math.pi : 0) + math.atan(v(1) / v(0))
}


in your scene, the undo also erases the script, but the +/- error is different there
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
User avatar
monstertje3
 
Posts: 343
Joined: Sat Sep 05, 2009 4:29 pm
Location: N-H, NL

Re: Modern mouse follow

Postby Kilinich » Sun Dec 11, 2011 8:42 pm

No +/- error for me.
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: Modern mouse follow

Postby monstertje3 » Sun Dec 11, 2011 9:14 pm

probably the attaching of the two geoms (wich one on top)
Basically, there are only 10 types of people in the world. Those who know binary, and those who don't.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
User avatar
monstertje3
 
Posts: 343
Joined: Sat Sep 05, 2009 4:29 pm
Location: N-H, NL


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 13 guests