Last active
August 29, 2015 14:07
-
-
Save ayamflow/1a9e1ae85157271f0d3c to your computer and use it in GitHub Desktop.
Code Physics cheat sheet
This file contains 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
Code physics cheat sheet | |
=== | |
- velocity = variation of position over time | |
- acceleration = variation of velocity over time | |
- friction = opposite of velocity. Fast friction: using a scalar instead of using an opposite vector. (i.e. velocity * 0.9) | |
Velocity with spring & friction (AKA elastic ease) | |
``` | |
velocity += dx * spring | |
velocity *= friction | |
x += velocity | |
``` | |
Kinematics | |
``` | |
pin.x = this.x + Math.cos(this.theta) * this.width; | |
pin.y = this.y + Math.sin(this.theta) * this.width; | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment