Skip to content

Commit

Permalink
add camera movement support for playback video rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomityGuy committed Oct 29, 2022
1 parent e024376 commit 7fadaf6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/ts/replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export class Replay {
currentJumpSoundTime = 0;
currentBounceTime = 0;

playbackCamera = false;

constructor(level?: Level) {
if (level) {
this.level = level;
Expand Down Expand Up @@ -376,8 +378,10 @@ export class Replay {
this.level.marble.body.orientation.copy(this.marbleOrientations[i]);
this.level.marble.body.linearVelocity.copy(this.marbleLinearVelocities[i]);
this.level.marble.body.angularVelocity.copy(this.marbleAngularVelocities[i]);
// this.level.yaw = this.cameraOrientations[i].yaw;
// this.level.pitch = this.cameraOrientations[i].pitch;
if (this.playbackCamera) {
this.level.yaw = this.cameraOrientations[i].yaw;
this.level.pitch = this.cameraOrientations[i].pitch;
}

if (this.currentAttemptTimes !== null) {
this.level.timeState.currentAttemptTime = this.currentAttemptTimes[i];
Expand Down
1 change: 1 addition & 0 deletions src/ts/ui/video_renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export abstract class VideoRenderer {
level.replay = this.replay;
this.replay.level = level;
this.replay.mode = 'playback';
this.replay.playbackCamera = true;

await level.start();

Expand Down

0 comments on commit 7fadaf6

Please sign in to comment.