Hi there,
i am just coding a simple model-library and i have some problems with rotating the sprite by it's center.
I think the problem is somewhere by setCenter, it doesn't matter if i set the center to a new position or let it by (0, 0), it always rotates by the point (0, 0).
Here's the code:
bool ModelStatic::setRotation(Rotation rotation){
if(!this->md_hasRotation[rotation] && this->md_perspective != Perspective::bird){
cout << "[EIMODEL] Failed to set rotation " << rotation << " for model '" << this->md_name << "', rotation is not set for this model!" << endl;
return false;
}
this->md_rotation = rotation;
this->md_spBirdPerspective.setOrigin(this->md_spBirdPerspective.getGlobalBounds().width / 2, this->md_spBirdPerspective.getGlobalBounds().height / 2);
this->md_spBirdPerspective.setRotation((UINT)this->md_rotation * 90.0f);
this->md_spBirdPerspective.setOrigin(0, 0);
this->setSize(Vector2f(this->md_spBirdPerspective.getGlobalBounds().width, this->md_spBirdPerspective.getGlobalBounds().height));
this->adjustHitbox();
return true;
}
Thanks in advance