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:
- View 1: 0s to 10s
- View 2 10s to 20s
- 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)