harvester actually sortof works now

This commit is contained in:
Chris Forbes
2009-11-03 19:24:28 +13:00
parent cda22ba7be
commit 1b131465fd
7 changed files with 69 additions and 18 deletions

View File

@@ -56,6 +56,13 @@ namespace OpenRa.Game.Traits
return facing + turn;
}
public static int QuantizeFacing(int facing, int numFrames)
{
var step = 256 / numFrames;
var a = (facing + step / 2) & 0xff;
return a / step;
}
static float2 RotateVectorByFacing(float2 v, int facing, float ecc)
{
var angle = (facing / 256f) * (2 * (float)Math.PI);