Skip to content

Instantly share code, notes, and snippets.

@mackwic
Last active December 11, 2015 20:59
Show Gist options
  • Save mackwic/4659006 to your computer and use it in GitHub Desktop.
Save mackwic/4659006 to your computer and use it in GitHub Desktop.
void moveRight(float step, float oldAngle) {
float diffAngle = abs(oldGravityAngle - world.getGravityAngle());
Vec2 velocity = new Vec2(getXVelocity() * cos(diffAngle), getYVelocity() * sin(diffAngle));
Vec2 gotoRight = new Vec2(step * world.getGravityForce() * horizontalSpeed, 0);
Vector.rotate2D(gotoRight, world.getGravityAngle());
applyImpulse(gotoRight.x, gotoRight.y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment