0

こんにちはBOX2dには、ポリゴンがわかっているフィクスチャがあります。

b2Shape *sh = fixture->GetShape();
NSLog(@"Type %d", sh->GetType());
//this returns 1, means its a polygon.

次に、頂点がどのような形状であるか、つまり長方形の正方形などを正確に知るために、頂点を取得する方法を説明します。

4

1 に答える 1

0

ポリゴンであることがわかっている場合は、それをb2PolygonShapeにキャストし、GetVertices()を呼び出します。

if(sh->GetType()==1)
{
    b2PolygonShape* poly = (b2PolygonShape*)sh;
    b2Vec2* verts = poly->GetVertices();
}

ドキュメント:http ://www.linuxuser.at/elements/doc/box2d/classb2_polygon_shape.htm#0e8a0b73c98b3e57f26772d14f252e8b

于 2011-01-06T14:18:59.097 に答える