1
General / Re: Trying to sync rocket with rocket launcher
« on: February 04, 2022, 12:21:32 am »That looks like getRot() is returning angles in degrees.
But cos and sin take angles in radians.
Try making it:
this->rocket->updatePos(sf::Vector2f(this->player->getPos().x + (25 * cos(this->rocket->getRot() * 3.141592654f / 180.f)), this->player->getPos().y + (25 * -sin(this->rocket->getRot() * 3.141592654f / 180.f))));
It also looks like the rocket is rotating in the wrong direction, if so, try removing the - from the sin part, that will reverse rotation.
Thank you very much, this works perfectly!