Skip to content

Getting the highest-priority camera #344

Discussion options

You must be logged in to vote

It depends a bit on the scene structure and whether if you have both a PCamHost and the PCams in the scene, but you could for example do:

PhantomCameraManager.phantom_camera_hosts[0].get_active_pcam()

Which fetches the currently active PCam, i.e. the PCam with the highest priority in the scene.


Otherwise, if you only got PCams in a scene, you would currently have to filter the list by doing something like:

var pcams_by_priority: Array
pcams_by_priority = PhantomCameraManager.phantom_camera_3ds
pcams_by_priority.sort_custom(
  func (a: PhantomCamera3D, b: PhantomCamera3D):
    return a.priority > b.priority
)

Then you can just grab the first index item of the array with pcams_by_priority[0].

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by eisegesis-623
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants