I want my projectile to start at the red dot everytime I shoot
barrel is a child of my gun’s body
problem:
my formula:
radius = SCALEX(barrelInView->getBoundingBox().size.width) + basicProjectile->getBoundingBox().size.width/2;
Vec2 center = body->getPosition();
float angle = body->getRotation();
finalX = center.x + radius * cos(angle);
finalY = center.y + radius * sin(angle);
result of the formula from log :
angle -15.912188
body center x:362.000000 y:519.799988
radius 126.000000
finalX 238.618454 finalY 545.353760
what’s wrong with my formula?