Search found 2 matches

by danjoemybro
Tue Apr 27, 2021 9:24 am
Forum: Support and Development
Topic: Smoothly rotate to face the cursor
Replies: 15
Views: 14456

Re: Smoothly rotate to face the cursor

Haha, google search pretty much, whilst typing in a bunch on nonsence around the topic of the problem which I was facing. I never would have worked this out by myself.
by danjoemybro
Mon Apr 26, 2021 9:44 am
Forum: Support and Development
Topic: Smoothly rotate to face the cursor
Replies: 15
Views: 14456

Re: Smoothly rotate to face the cursor

iPoisonxL's code is almost correct. One thing is missing, namely the two angles zero and 2pi are the same, even though the two numbers differ a lot. To determine whether to turn left or right, you need calculate diff as follows: local diff = (goal-current+math.pi)%(2*math.pi)-math.pi That way diff ...