GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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.Posts: 12,822Member

    Use:

    round( self.Rotation / 90) *90

  • Twisted WireTwisted Wire Posts: 13Member, PRO

    Thanks Socks, that worked.

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

    @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.