Windows Calculating the radius of a turn.

So basically I'm making a virtual version of a turn based table top game I play. I made visual representations of the movement rulers in the game ( forward, bank slight right or left, hard turn right or left). My question is how do I calculate the rotation of the sprite as well as the radius of the turn to match where the sprite should be at the end of its movement? Example: The movement for the unit I choose is: Bank slight right at 1 speed(diagonal movement) how would I calculate the turn of its radius to match the stencil but also to rotation of the sprite?

p.s the turn system is built on a 2 state machines, one controlling the phases of the round and the other controlling the stages of the combat phase. Also I have Variable fail safe switchboards to trigger the state machines and also turn other variables off as others turn on( if (aa = true {bb = false; cc = false; ext.})
 
You might want to attach a visual representation of what you are asking for because I'm not sure if I understand. Maybe someone else will know what your asking for but reading your post a few times I'm not really following what your issue is.

If I had to guess though you have setup a bunch of sprite animations and you want to rotate them in game so that they are positioned in the correct spot on the board. Well if that's the case then it should be pretty easy to get the right angle. Assuming that your Sprite animations have the image origin fixed at the right position where the Sprite should rotate around then it should be as simple as running the point_direction() function with the current position of the Sprite and it's end position... That would tell you the angle. For the radius I'm not sure, but radius is half a circle, so if you needed the radius from the Sprite position to it's end position then it would just be the distance between the two.

I have a feeling I'm way off on what you are looking for, if so and no one else posts a solution you should take a few minutes and come up with a visual like I was saying above.
 

Joe Ellis

Member
I was gonna say the same, and I'm "super experienced in stuff like this". Can't think of much else than using point_direction and point_distance

-Edit
Sorry I posted that at the exact same time as your reply


That looks complicated to me, I don't know if it's more complicated than it needs to be.
I've done stuff like that before but it was with extruding, and making curved roads.
 

Joe Ellis

Member
Right, it seems like the radius you're calling it is just the angle which it turns. If it's not that, you're trying to do something super complicated. I can give you help with that if that's really what you need: just not sure at the moment whether it can be done in a simpler way
 
So the reason im doing it this way is because the game is really precise. I want pros to be able to use this simulator as a practice tool so the movement has to match perfectly. I think this example might be a little more clear. I mentioned the radius of the turn because the determines how far the unit moves and how much it rotates, I think this would be a more precise system than placing the sprite at the end of he ruler and just guessing where it ends up.

so the second turn has less radius so it doesn't turn as much or go as far how to I calculate how far either move moves my unit
 

Attachments

I've designed the curve as a visual aid when you move a unit. I'm just trying to calculate where the top box at the end will end up.

This is the information on the turn templates

Straight Templates

  • 1 Straight Length – 40mm
  • 2 Straight Length – 80mm
  • 3 Straight Length – 120mm
  • 4 Straight Length – 160mm
  • 5 Straight Length – 200mm
Turn Templates

  • 1 Turn Inside Radius – 25.0
  • 1 Turn Outside Radius – 45.0
  • 2 Turn Inside Radius – 53.0
  • 2 Turn Outside Radius – 73.0
  • 3 Turn Inside Radius – 80.0
  • 3 Turn Outside Radius – 100.0
Bank Templates

  • 1 Bank Inside Radius – 70.0
  • 1 Bank Outside Radius – 90.0
  • 2 Bank Inside Radius – 120.0
  • 2 Bank Outside Radius – 140.0
  • 3 Bank Inside Radius – 170.0
  • 3 Bank Outside Radius – 190.0
 

NightFrost

Member
Can the turn templates be described as sections of a circle? In that case they would simply be circular rotation calculations (trigonometry) and the biggest job would be picking the correct corner before rotation, and setting in place by correct corner after rotation.
 
Top