# Angle lerp direction?

Get help using Construct 2

### » Wed Dec 10, 2014 10:03 pm

I'm trying to create a turret arm for player that turns with lerp depending on buttons pressed. My problem is that I don't know how to change the lerp's direction from clockwise to counter-clockwise. The turret arm should rotate from pointing forward (0) to pointing straight up (270).

The command I'm using is lerp(Player_Turretarm.Angle,270, 8*dt)

I tried making the angle 270 to -90 but it just made the arm rotate nonstop like crazy.
B
22
S
7
G
4
Posts: 235
Reputation: 3,503

### » Wed Dec 10, 2014 11:16 pm

I think you want anglelerp. For example:

Code: Select all
`anglelerp(Self.Angle,TargetAngle,8*dt)`

^This will lerp from the turrets current angle to the target angle. The rotation is determined by the closest angle. So:

Code: Select all
`anglelerp(Self.Angle(is 0),170,8*dt)`

...will rotate clockwise, because that is the shortest distance. Whereas:
Code: Select all
`anglelerp(Self.Angle(is 0),190,8*dt)`

...will rotate counterclockwise, for the same reason.
B
45
S
10
G
11
Posts: 1,106
Reputation: 9,732

### » Thu Dec 11, 2014 1:48 am

Oh, my. It's that simple. I've completely missed the anglelerp. Thanks for the help, this fixed my problem
B
22
S
7
G
4
Posts: 235
Reputation: 3,503