What do you want to achieve?
I want to understand what Tower Defense Simulator (TDS) is doing in order to make towers lean against the movement direction.
What is the issue?
Typically, when you place a tower in TD games, they stand upright like so:
However, in TDS, they move against the movement direction, and I want to understand what’s happening there:
What solutions have you tried so far?
None. I don’t know where to begin.
Hey there! It’s funny, since, I just randomly discovered this a few years ago, completely by chance! Using the “AlignPosition” instance, on a part at the character’s feet, it should tilt the model atop.
Let me know if you get it working, otherwise I’ll let you know the specifics!
tilt the model to the side a bit so its “leaning” in some random direction
then you can calculate the x and z distances between the two with firstPosition.X - secondPosition.X and the same for z
now that you have x and z distances, you can imagine them as opposite and adjacent sides on a right triangle and use inverse tangent to find the angle needed to point the tower towards the enemy