Modern mouse follow
8 posts • Page 1 of 1
Modern mouse follow
Ok, next evolution of mouse follow script - no lasers, no scene.my variables.
Script for hinge bendTarget:
It's phunlet-safe but script killed (need to be re-entered) on clone/copy-paste.
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.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Modern mouse follow
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
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
Thanks. Downloaded b10 and now everything works.
- s_noonan
- Posts: 61
- Joined: Tue Mar 30, 2010 2:25 am
Re: Modern mouse follow
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.
in your scene, the undo also erases the script, but the +/- error is different there
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.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-
monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
Re: Modern mouse follow
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.
Light travels faster than sound. That's why some people appear bright until they open their mouths.
-
monstertje3 - Posts: 343
- Joined: Sat Sep 05, 2009 4:29 pm
- Location: N-H, NL
8 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest