Rotating coins, as3

What's the best way to do coin rotation? I tried Math.random but the coin was not swinging correctly.

start code

//ROTATION
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
function enterFrameHandler(event:Event):void
{
/*
ADD VELOCITY, GRAVITY, ACCELERATION
*/
coin.rotationY += 8;
}

      

tried this but it has no gravity or accelleration

//ROTATION AND RANDOM MATH
function wobble():void {
var wobble = ((Math.random()*4)-2);
flk.rotationY -= 11+wobble/2;
flk.rotationX -= 2+wobble/20;
}
var myInterval:uint = setInterval (wobble, 40);

      

alt text http://www.ashcraftband.com/myspace/videodnd/coin.jpg

+2


a source to share


1 answer


The actual math involved in the spinning coin (or Euler Disk) is quite complex , and definitely not random. See more details here if you're interested.



+4


a source







All Articles