I am simply trying to create a b2PolygonShape from a b2Shape but I am having an error that says: Dynamic-cast from 'const b2Shape*' to 'b2PolygonShape*' casts away qualifiers
This is my code:
const b2Shape *s = fix2.shape;
b2PolygonShape *p = dynamic_cast<b2PolygonShape*>(s);
What am I doing wrong?
It is the
constqualifier that the compiler complains about. The solution is todeclare
pas pointer toconst b2PolygonShape: