Rodrigo
Rodrigo

Reputation: 311

use of undeclared identifier 'cpPolyShapeGetNumVerts'

I am trying to use cpPolyShapeGetNumVerts on Chipmunk2D 7.X and it seems it was removed.

How can I replace it?

Upvotes: -5

Views: 67

Answers (1)

Rodrigo
Rodrigo

Reputation: 311

The answer is

  const auto position = cpBodyGetPosition(_props.body.get());
  const int count = cpPolyShapeGetCount(_props.shape.get());

  std::vector<cpVect> vertices(count);
  for (int i = 0; i < count; ++i) {
    vertices[i] = cpPolyShapeGetVert(_props.shape.get(), i);
  }

Upvotes: 1

Related Questions