Course: Building a Block Based Game

There is one little issue in the Placing Blocks tutorial which can be improved.
That is, when the character turns to the clicked direction, it may turns from the opposite side with a larger rotation angle rather than from the side with a smaller one.
This is happened when one of the rotation yaw returned by the “Get Actor Rotation” and “Find Lookat Roation” function is less than 0, and the absolute value of difference of the two rotation yaw is larger than 180 degrees.
So it’s better to increase the rotation yaw by 360 degrees if the CurrentRotation or TargetRotation variable is minus in this case.
Below is the solution I made for your reference.

1 Like