Angle lerp direction?

0 favourites
  • 3 posts
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • 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.

  • I think you want anglelerp. For example:

    ^This will lerp from the turrets current angle to the target angle. The rotation is determined by the closest angle. So:
    [code:25qrzfms]anglelerp(Self.Angle(is 0),170,8*dt)[/code:25qrzfms]
    ...will rotate clockwise, because that is the shortest distance. Whereas:
    anglelerp(Self.Angle(is 0),190,8*dt)[/code:25qrzfms]
    ...will rotate counterclockwise, for the same reason.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Oh, my. It's that simple. I've completely missed the anglelerp. Thanks for the help, this fixed my problem

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)