- Joined
- Jun 14, 2007
- Messages
- 56
Hi gents.
Simple problem here;
I want to have a unit slowly rotate, at a constant speed, to face the way the controlling player clicks
The idea is that it is not a one off thing, rather something that will constantly update in the main looping trigger.
the looped script cannot be something as simple as this:
furthermore it cannot be something like this:
as angles are clamped between 0 and 360. If you are facing angle 10 and you click angle 350 then it would go all the way around turning left, instead of turning right which is closest.
So what is an easy, clean way of making a unit choose to either start rotating left or rotating right to eventually be facing the same direction as has been ordered?
Help is much appreciated.
Matt
Simple problem here;
I want to have a unit slowly rotate, at a constant speed, to face the way the controlling player clicks
The idea is that it is not a one off thing, rather something that will constantly update in the main looping trigger.
the looped script cannot be something as simple as this:
-
Unit - Make unit face point over 2.0 seconds
furthermore it cannot be something like this:
JASS:
local real direction
local real angle = AngleBetweenPoints(unit, target)
if angle > direction then
set direction = direction + 10
else
set direction = direction - 10
endif
call UnitFaceAngle(unit, direction)
So what is an easy, clean way of making a unit choose to either start rotating left or rotating right to eventually be facing the same direction as has been ordered?
Help is much appreciated.
Matt