Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freecam #48

Merged
merged 10 commits into from
Oct 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 11 additions & 30 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 12 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "replay-viewer",
"version": "0.5.2",
"version": "0.5.3",
"description": "Rocket League replay viewer React component and tooling",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions src/builders/GameBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { LoadingManager } from "three"
import CameraManager from "../managers/CameraManager"
import DataManager from "../managers/DataManager"
import { GameManager } from "../managers/GameManager"
import KeyManager from "../managers/KeyManager"
import { ReplayData } from "../models/ReplayData"
import { ReplayMetadata } from "../models/ReplayMetadata"
import FPSClock from "../utils/FPSClock"
Expand Down Expand Up @@ -31,6 +32,7 @@ const defaultGameBuilder = async ({
defaultAnimationBuilder(replayData, sceneManager.players, sceneManager.ball)
DataManager.init({ replayData, replayMetadata })
CameraManager.init()
KeyManager.init()

return GameManager.init({
clock,
Expand Down
7 changes: 7 additions & 0 deletions src/builders/field/addCameras.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DEFAULT_CAMERA_OPTIONS } from "../../constants/defaultCameraOptions"
import {
ABOVE_FIELD_CAMERA,
BLUE_GOAL_CAMERA,
FREE_CAMERA,
ORANGE_GOAL_CAMERA,
ORTHOGRAPHIC,
} from "../../constants/gameObjectNames"
Expand All @@ -24,6 +25,11 @@ export const addCameras = (scene: Scene) => {
aboveFieldCamera.position.set(0, 2000, 0)
scene.add(aboveFieldCamera)

const freeCamera = new PerspectiveCamera(...DEFAULT_CAMERA_OPTIONS)
freeCamera.name = FREE_CAMERA
freeCamera.position.set(0, 1000, 0)
scene.add(freeCamera)

const generateOrthographicCamera = () => {
const camera = new OrthographicCamera(-320, 320, 240, -240, 0.1, 20000)
camera.zoom = 0.05
Expand Down Expand Up @@ -68,6 +74,7 @@ export const addCameras = (scene: Scene) => {
blueGoalCamera,
orangeGoalCamera,
aboveFieldCamera,
freeCamera,
...orthographicCameras,
]
}
1 change: 1 addition & 0 deletions src/constants/eventNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export const CAMERA_FRAME_UPDATE = "CAMERA_FRAME_UPDATE"
export const PLAY_PAUSE = "PLAY_PAUSE"
export const FRAME = "FRAME"
export const CANVAS_RESIZE = "CANVAS_RESIZE"
export const KEY_CONTROL = "KEY_CONTROL"
1 change: 1 addition & 0 deletions src/constants/gameObjectNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const GROUP_SUFFIX = "-group"
export const BLUE_GOAL_CAMERA = "Blue Goal Camera"
export const ORANGE_GOAL_CAMERA = "Orange Goal Camera"
export const ABOVE_FIELD_CAMERA = "Above Field Camera"
export const FREE_CAMERA = "Free Camera"
export const ORTHOGRAPHIC = {
ABOVE_FIELD: "ORTHOGRAPHIC_ABOVE_FIELD",
BLUE_LEFT: "ORTHOGRAPHIC_BLUE_LEFT",
Expand Down
Loading