Created
November 27, 2018 13:11
-
-
Save fabulousduck/0021526b475d06d77dfd675146674b32 to your computer and use it in GitHub Desktop.
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
private void updateVehicle(double dt) { | |
this.position.x += Math.cos ( Math.PI * this.orientation / 180.0) * dt * | |
(this.leftWheel.getSpeed () + this.rightWheel.getSpeed ()) / 2; | |
this.position.y += Math.sin ( Math.PI * this.orientation / 180.0) * dt * | |
(this.leftWheel.getSpeed () + this.rightWheel.getSpeed ()) / 2; | |
this.position.orientation += 0.5 * dt * ( this.rightWheel.getSpeed() - this.leftWheel.getSpeed()); | |
this.position.orientation = ( this.position.orientation + 360) % 360; // keep orientation within range 0 -360 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment