1

これは、衛星が惑星で行うように、正方形を円の周りに移動する私の方法です。

-(CGPoint)circularMovement:(float)degrees radius:(CGFloat)radius{        
        float x = (planet.position.x + planet.radius) *cos(degrees);
        float y = (planet.position.y + planet.radius) *sin(degrees);

        CGPoint posicion = CGPointMake(x, y);
        return posicion;
}

ご覧のとおり、衛星の x と y の位置を取得し、度++ でこのメソッドを呼び出すと、惑星の周りの円運動が得られました。

しかし、この運動システムに関する私の問題はsatelite.position.x+satelite.size.width/2、同じ運動システムで動き回る別のオブジェクトとの衝突を検出するために 度が必要なことです。

この値を取得する方法を知っている人はいますか??

4

1 に答える 1