views:

202

answers:

1
+2  Q: 

coin rotation, as3

What's the better way to make a coin rotation? I tried Math.random, but the coin doesn't wobble correctly.

starter 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

+5  A: 

The actual maths involved in a spinning coin (or Euler's Disk) is fairly complex, and definitely not random. There's more detail here if you're interested.

Richard Inglis
If anyone knows a simple equation let me know. Appreciate it.
VideoDnd