Re: [Flashcoders] Mouse Velocity?

2007-06-21 Thread eric e. dolecki
+ ", " + deltaX ); trace( Math.floor(velocity) + ", (" +deltaX+ ", " + deltaY +")"); } MouseX = newMouseX; MouseY = newMouseY; }; - Original Message - From: "Joshua Sera" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; Sent: Th

[Flashcoders] Mouse Velocity?

2007-06-21 Thread Sergei Nikiforovski
t; + deltaY +")"); } MouseX = newMouseX; MouseY = newMouseY; }; - Original Message - From: "Joshua Sera" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; Sent: Thursday, June 21, 2007 1:37 PM Subject: Re: [Flashcoders] Mouse Velocity? Well yeah. If you'r

Re: [Flashcoders] Mouse Velocity?

2007-06-21 Thread Joshua Sera
Well yeah. If you're doing a verlet integration-style thing where all you store about a particle is it's last position, and it's current position, and you're not using a constant time step, you have to do that. Storing the last 5 updates is a seperate thing. This is just to overcome the differenc

Re: [Flashcoders] Mouse Velocity?

2007-06-21 Thread Ron Wheeler
Would you not eliminate the whole problem by keeping track of the time that the previous position was taken along with its coordinates and use that to calculate the time between the readings and divide that into the distance? Then you do not care if the set interval or on enter frame come at eq

Re: [Flashcoders] Mouse Velocity?

2007-06-20 Thread Joshua Sera
It's indeed a setInterval problem, as the interval and mouse movement won't necessarily match up. onMouseMove can also be a problem, as you'll wind up with a lot of readings going straight up/down/right/left, rather than in the direction you're moving. What I've done for this problem is to averag

RE: [Flashcoders] Mouse Velocity?

2007-06-20 Thread Jesse Graupmann
ric e. dolecki Sent: Wednesday, June 20, 2007 10:29 AM To: Flashcoders mailing list Subject: [Flashcoders] Mouse Velocity? I am calculating mouse velocity, but every now and then you get a 0 for velocity eventhough its not 0 (setInterval prob I suspect). Any better approach? var MouseX; var Mouse

Re: [Flashcoders] Mouse Velocity?

2007-06-20 Thread elibol
Try using onMouseMove/onEnterFrame to collect the mouse position. You are sure to get changes per frame with either approach, but onMouseMove is probably better in terms of performance. Still use setInterval to get the data collected last from onMouseMove and average the data to get a measurement

[Flashcoders] Mouse Velocity?

2007-06-20 Thread eric e. dolecki
I am calculating mouse velocity, but every now and then you get a 0 for velocity eventhough its not 0 (setInterval prob I suspect). Any better approach? var MouseX; var MouseY; function determineVelocity():Void { MouseX = _root._xmouse MouseY = _root._ymouse setTimeout( calc, 9 ); };