There's a very simple and basic easing equation 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 your object depending on mouse position. Then you run it through this equation, where easeSpeed = 1 is no easing, and 0.01 is very slow easing (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 need > easing.http://www.gizma.com/easing/ > > For spinning an object with 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 an object, but instead > > of rotating the camera around the object I need to rotate the object > > when the user clicks the mouse.. > > > I had a nice bit of code that rotated the camera with a nice amount of > > easing on, that reacted nicely to the speed you moved the mouse.. I’ve > > tried to adapted it to for spinning the object but it’s not really > > work.. > > > Has anyone got any good examples? > > > Many thanks
