+ ", " + deltaX );
trace( Math.floor(velocity) + ", (" +deltaX+ ", " + deltaY +")");
}
MouseX = newMouseX;
MouseY = newMouseY;
};
- Original Message -
From: "Joshua Sera" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>;
Sent: Th
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
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
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
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
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
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
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 );
};
8 matches
Mail list logo