How to make an actor snap to an angle?

I'm making a game, and in this game, I need to have an actor that when it is finished rotating, it will snap to an angle, either 0, 90, 180, or 270. I am having trouble doing this and would really like some help ASAP.

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    Use:

    round( self.Rotation / 90) *90

  • Twisted WireTwisted Wire Member, PRO Posts: 13

    Thanks Socks, that worked.

  • SocksSocks London, UK.Member Posts: 12,822

    @TimeBombGames said:
    Thanks Socks, that worked.

    Good ! :)

    You can interpolate to that value - or just use a change attribute behaviour depending on your needs, personally I think the interpolate would look nicer.

Sign In or Register to comment.