How does this mouse-following scene work?
2 posts • Page 1 of 1
How does this mouse-following scene work?
I downloaded this which is a simple (but hard for me to understand) scene which uses very little thyme script. When I first looked at it, my assumption was that the script simply commanded the motor (hinge) to rotate based on the position of the mouse pointer. But that's not how it works! I dug into this scene peice-by-peice in an attempt to reverse engineer it, and I'm close to going crazy trying to figure out how it was done. So someone please save my sanity by explaining how it rotates without activating a motor. I was going to contact the author "Raydeg" but I was not able to make contact with him/her through the personal messaging system.
Thanks!
Thanks!
-
Xray - Posts: 500
- Joined: Sun Jun 17, 2012 6:12 am
- Location: USA
Re: How does this mouse-following scene work?
my psychic powers tell me it goes something like
(e)=>{e.geom.materialVelocity = -(2 * (e.normal(1) * (app.mousepos(0) - e.pos(0)) - e.normal(0) * (app.mousepos(1) - e.pos(1))) / (((app.mousepos(0) - e.pos(0)) ^ 2 + (app.mousepos(1) - e.pos(1)) ^ 2) ^ 0.5))}
(e)=>{e.geom.materialVelocity = -(2 * (e.normal(1) * (app.mousepos(0) - e.pos(0)) - e.normal(0) * (app.mousepos(1) - e.pos(1))) / (((app.mousepos(0) - e.pos(0)) ^ 2 + (app.mousepos(1) - e.pos(1)) ^ 2) ^ 0.5))}
- jon_joy_1999
- Posts: 233
- Joined: Fri Dec 09, 2011 12:51 am
2 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests