Y offset with app.mousepos?
3 posts • Page 1 of 1
Y offset with app.mousepos?
I spawned a circle which I want to follow my mouse cursor. Of course that's easily done by setting the position variable pos to pos:= {app.mousepos}. The circle follows the cursor just fine, except it is offset in the Y direction. With Algodoo running, the circle follows the cursor approximately 0.15 meters BELOW the tip of the cursor arrow! If I stop Algodoo by pressing the space-bar, then the center of the circle jumps directly to the tip of the cursor arrow. When I hit the space-bar again, the circle drops down below the cursor again. Just for your reference, the radius of my circle is 0.014.
By the way, if I zoom way in just prior to spwning the circle, and then I spawn the circle (I use a keyboard key to trigger a laser), the circle spawns directly at the tip of my cursor, but then "SLOWLY" drops down about 0.15 meters below the cursor. Then after that intial slow drop, the circle JUMPS very quickly up and down each time I start and stop Algodoo!
What's going on here?
Thanks!
EDIT -- Within five minutes after I posted this question, I figured out what's going on! GRAVITY is pulling on my circle!!! (DUH!) . And this makes sense because when Algodoo is not running, there is no gravity, and so the circle follows precisely. When gravity is turned on with Algodoo, it tugs on the circle, pulling it down below the cursor.
PROBLEM SOLVED!
By the way, if I zoom way in just prior to spwning the circle, and then I spawn the circle (I use a keyboard key to trigger a laser), the circle spawns directly at the tip of my cursor, but then "SLOWLY" drops down about 0.15 meters below the cursor. Then after that intial slow drop, the circle JUMPS very quickly up and down each time I start and stop Algodoo!
What's going on here?
Thanks!
EDIT -- Within five minutes after I posted this question, I figured out what's going on! GRAVITY is pulling on my circle!!! (DUH!) . And this makes sense because when Algodoo is not running, there is no gravity, and so the circle follows precisely. When gravity is turned on with Algodoo, it tugs on the circle, pulling it down below the cursor.
PROBLEM SOLVED!
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: Y offset with app.mousepos?
Glad your issue is solved!
For future reference, app.mousepos is an array, so can also be read as
(App.mousepos(0), app.mousepos(1))
Ps, I haven't done thyme in a while, so format may be different, but using that method you can work with the values of the array!
For future reference, app.mousepos is an array, so can also be read as
(App.mousepos(0), app.mousepos(1))
Ps, I haven't done thyme in a while, so format may be different, but using that method you can work with the values of the array!
When asking for help, READ THE STICKIES!
- electronicboy
- Posts: 1694
- Joined: Mon Aug 31, 2009 6:18 pm
Re: Y offset with app.mousepos?
electronicboy wrote:
For future reference, app.mousepos is an array, so can also be read as
(App.mousepos(0), app.mousepos(1))
Hi electronicboy.... I am aware of that. And for other people wanting to read those individual array elements, (0) is the X axis, and (1) is the Y axis of the cursor position.
Thanks for your reply!
xray
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
3 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 27 guests