Im trying to make flames follow my object, I set the direction for my moving object using the points between it and another object (using static destination for testing).
No matter what I do I cannot use the radians (which I use to set the direction), translate them to degrees, then rotate my flames so it looks like they are following it (like a comet).
What I try:
sprite.setPosition(pos.x, pos.y);
radians = Math.atan2(0 - pos.y, 540 - pos.x); //set radians
degrees = radians * 180 / MathUtils.PI; //calculate degrees
fireSprite.setPosition(sprite.getX(), sprite.getY());
fireSprite.setRotation((float)degrees); //rotate according to degrees
I move the object like this:
pos.x += 200 * Math.cos(radians) * delta;
pos.y += 200 * Math.sin(radians) * delta;
Am I missing something in the math? I feel like it should work.
An example of result from calculations:
radians: -1.8745297149164084, degrees: -107.4026382478209
radians: -1.1776894171295331, degrees: -67.47663130103584
radians: -2.1756410640936705, degrees: -124.65504723907603
radians: -1.2244578042111383, degrees: -70.15626242087843
The flames face the wrong direction, and not in a any sort of pattern I can use to debug my problem.