1
Graphics / Struggling with some rotations
« on: April 23, 2021, 11:07:08 pm »
I'm trying to figure out how to move and rotate a bullet projectile from my starting location to an ending location. For example:
I have a function called HomingMissle, which takes the inputs of a target Vector2f, where I'm aiming, my players current position as a vector2f, a current velocity, a maximum rotation speed and of course, delta time. I've essentially got the basic idea setup.
I'm subtracting the target from my current position to get the direction. Then I'm using atan2(direction.y, direction.x) to get the angle in radians. However, I'm struggling to limit the amount of rotations that can be performed on tick. I only want to rotate a partial amount of the entire rotation, up to a limit based on the maximum_rotation input variable.
Any ideas?
Thanks,
Brandon
I have a function called HomingMissle, which takes the inputs of a target Vector2f, where I'm aiming, my players current position as a vector2f, a current velocity, a maximum rotation speed and of course, delta time. I've essentially got the basic idea setup.
I'm subtracting the target from my current position to get the direction. Then I'm using atan2(direction.y, direction.x) to get the angle in radians. However, I'm struggling to limit the amount of rotations that can be performed on tick. I only want to rotate a partial amount of the entire rotation, up to a limit based on the maximum_rotation input variable.
Any ideas?
Thanks,
Brandon