精灵套件中米和点之间的比例是多少? '因为在苹果文档上它说速度和加速度是米/秒 - 米/秒^ 2,但它没有以点/秒等进行转换。
我尝试使用apple的sprites velocity属性测量对象的速度,或者手动计算每秒的点数,然后我以1:1的比例出现,意味着1m / s = 1point / s。
现在,有人可以证实吗?还是我完全错了?
以下是我用于计算的代码:
double dt = currentTime - previousTime;
previousTime = currentTime;
double x = ball.physicsBody.velocity.dx;
double y = ball.physicsBody.velocity.dy;
double mod = sqrt(x*x+y*y);
double x2 = (ball.position.x-previousPosition.x)/dt;
double y2 = (ball.position.y-previousPosition.y)/dt;
double mod2 = sqrt(x2*x2+y2*y2);
if (mod2!=0){totalSpeed = totalSpeed + mod2;
j++;}
double mod3 = totalSpeed/j;
NSLog(@"Ball Speed: %.2f - %.2f - %.2f",mod,mod2,mod3);
previousPosition = ball.position;