Activate Boolean Signal Based on Camera View

I would like to activate a boolean signal when the camera is at a specific saved view.

For example. I have my Camera Animator set up as:

  1. View 1: 0s to 10s
  2. View 2 10s to 20s
  3. View 3: 20s to 30s

Then when the simulation runs, activate boolean signal when the camera gets to view 2.

My code is below. It works but seems slow and inefficient.

Has anyone implemented something like this in the past?

Thanks.

from vcScript import *

comp = getComponent()
app = getApplication()
sim = getSimulation()

def OnRun():
  
  camera = app.findCamera()

  views = app.Views

  viewMatrix = []

  for i in range(len(views)):
    viewMatrix.append(views[i].CameraMatrix)
    
  #print viewMatrix

  while (True):
    cameraView = camera.Matrix
    if (cameraView == viewMatrix[0]):
      print ("At Camera View 1")
    if (cameraView == viewMatrix[1]):
          print ("At Camera View 2")
    if (cameraView == viewMatrix[2]):
      print ("At Camera View 3")
    delay(.5)

hi,

This functionality is already available in the eCatalog with the FlyCamera component. Please refer to the FlyCamera – it can be used to set signals.

1 Like

There is a video in the Academy, which shows how to use this Fly Camera : Record a Simulation as a Video | Visual Components Academy

1 Like

Thanks for the recommendation. A couple of Fly Camera questions and/or possible improvements:

-Is it possible to disable it? I.E. Disable it so a user can manually control the camera? (Similar to the check box at the bottom of Camera Animator)

-Can you visualize location of the camera view(s) in the layout? Series of TrackRightHand components? FOV pyramids?

-Can you set constant speed of the camera between camera view(s)?

If not, it would be useful to visualize the linear distance between sequential views so you can set the ViewDelay to create uniform camera speed.

Thanks.