Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
remove broken camera debug rays
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField committed Nov 23, 2023
1 parent 4788533 commit 6891588
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
13 changes: 0 additions & 13 deletions packages/engine/src/camera/components/FollowCameraComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,12 @@ import { ArrowHelper, Clock, Vector3 } from 'three'

import { getState } from '@etherealengine/hyperflux'

import { Engine } from '../../ecs/classes/Engine'
import { Entity, UndefinedEntity } from '../../ecs/classes/Entity'
import { defineComponent } from '../../ecs/functions/ComponentFunctions'
import { ObjectLayers } from '../../scene/constants/ObjectLayers'
import { setObjectLayers } from '../../scene/functions/setObjectLayers'
import { CameraSettingsState } from '../CameraSceneMetadata'
import { CameraMode } from '../types/CameraMode'

//const cameraRayCount = 1
export const coneDebugHelpers: ArrowHelper[] = []
// todo properly turn into gizmo
export const debugRays = false

export const FollowCameraComponent = defineComponent({
name: 'FollowCameraComponent',
Expand Down Expand Up @@ -80,13 +74,6 @@ export const FollowCameraComponent = defineComponent({

for (let i = 0; i < raycastProps.rayCount; i++) {
cameraRays.push(new Vector3())
if (debugRays) {
const arrow = new ArrowHelper()
arrow.setColor('red')
coneDebugHelpers.push(arrow)
setObjectLayers(arrow, ObjectLayers.Gizmos)
Engine.instance.scene.add(arrow)
}
}

return {
Expand Down
14 changes: 1 addition & 13 deletions packages/engine/src/camera/systems/CameraSystem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import {
import { TransformComponent } from '../../transform/components/TransformComponent'
import { CameraSettingsState } from '../CameraSceneMetadata'
import { CameraComponent } from '../components/CameraComponent'
import { FollowCameraComponent, coneDebugHelpers, debugRays } from '../components/FollowCameraComponent'
import { FollowCameraComponent } from '../components/FollowCameraComponent'
import { SpectatorComponent } from '../components/SpectatorComponent'
import { TargetCameraRotationComponent } from '../components/TargetCameraRotationComponent'

Expand Down Expand Up @@ -158,18 +158,6 @@ export const getMaxCamDistance = (cameraEntity: Entity, target: Vector3) => {
if (hits[0] && hits[0].distance < maxDistance) {
maxDistance = hits[0].distance
}

if (debugRays) {
const helper = coneDebugHelpers[i]
helper.setDirection(rayDir)
helper.position.copy(target)

if (hits[0]) {
helper.setColor('red')
} else {
helper.setColor('green')
}
}
})

camRayCastCache.maxDistance = maxDistance
Expand Down

0 comments on commit 6891588

Please sign in to comment.