Last active
February 22, 2018 19:54
-
-
Save jamiegilmartin/a0938236147f332d46820d4c5251a700 to your computer and use it in GitHub Desktop.
Lerp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func update(deltaTime seconds: TimeInterval) { | |
| super.update(deltaTime: seconds) | |
| let lerpRate = 0.5 // or some normalized percentage | |
| x += (Target — x) * lerpRate | |
| myNode.position.x = x | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment