The equation above can still be used in your scenario if you only calculate the targetValue on mouse down. If you actually need 'throw physics' I'm going to have to point you in another direction ;)
On Apr 14, 4:07 pm, colouredfunk <[email protected]> wrote: > great thanks for your replies!! Works nicely for a general spin. But > I'm trying to triggering it on mouseDown event. then to ease it off to > a slow stop onMouseUp.. but I can only get it to stop abruptly... > > O_0 > > On Apr 13, 9:19 pm, RocketClowns <[email protected]> wrote: > > > > > > > > > There's a very simple and basiceasingequation that works on almost > > anything, and also works great with mouse input: > > > currentValue += (targetValue - currentValue) * easeSpeed > > > On every frame, you calculate - for example - the target rotation- > > angle of yourobjectdepending on mouse position. Then you run it > > through this equation, where easeSpeed = 1 is noeasing, and 0.01 is > > very sloweasing(must be a number between 0 and 1). > > > Here I'm using this formula on camera rotation: > > > var targetRotationY:Number = ((stage.mouseX / stage.stageWidth) - 0.5) > > * 360; > > view.camera.rotationY += (targetRotationY- view.camera.rotationY) * > > 0.06; > > > Does this make sense ;) ? > > > On Apr 13, 9:52 pm, Stephen Hopkins <[email protected]> wrote: > > > > I usually refer to this website when I > > > needeasing.http://www.gizma.com/easing/ > > > > Forspinninganobjectwith the mouse, you can try adding some > > > acceleration to the rotation based on how the mouse moved since the > > > last frame and deacceleration when the mouse lets go. Can have a > > > initial speed and max speed. > > > > On Apr 13, 9:58 am, colouredfunk <[email protected]> wrote: > > > > > Hi, > > > > > I’ve been using HoverCamera3D to rotate round anobject, but instead > > > > of rotating the camera around theobjectI need to rotate theobject > > > > when the user clicks the mouse.. > > > > > I had a nice bit of code that rotated the camera with a nice amount of > > > >easingon, that reacted nicely to the speed you moved the mouse.. I’ve > > > > tried to adapted it to forspinningtheobjectbut it’s not really > > > > work.. > > > > > Has anyone got any good examples? > > > > > Many thanks
