I am trying to use Carl Besters CCTV code. I have the cameras in CityEngine but when I run the cga script the viewshed is rotated by 180 degrees. So basically the narrow part is rotated around and the wide part is centered on the camera. Anyone have any suggestions? Code is below.
/**
* File: CCTV2.cga
* Created: 8 October 2015 12:02:25 GMT
* Author: Carl Bester
*/
version "2017.1"
#####################################
##Attributes
attr viewObject = "models/WebCamView.dae"
@Hidden
#The elevation of the camera
attr Elevation = 50
#The maximum distance range of the camera
attr ViewLength = 150
#The optical viewing angle of the camera
@Range(10,120)
attr CameraAngle = 90
#Azimuth direction of the camera
@Range(0,359)
attr Direction = 0
#The vertical viewing range of the furthest point (from bottom to top of the screen
attr VerticalHeight = 50
#The Calculated width of the scene
@Hidden
attr Width = getWidth(ViewLength)
#The vertical rotation of the camera view
@Range(0,90)
attr VerticalRotation = 20
#The actual azimuth value used to rotate the view. Internal Attributes
@Range (0,360)
@Hidden
attr HorizontalRotation = getRealDirection(Direction)
#####################################
##Functions
getWidth(x) = (tan(CameraAngle/2)*ViewLength)*2
getRealDirection(x) = -1 * (x + 180)
#####################################
##Rules
@StartRule
Lot--> Object
Object--> i(viewObject)
Rotate
Rotate--> rotate(abs, world,VerticalRotation,HorizontalRotation,0)
Scale
Scale--> s(Width,VerticalHeight,ViewLength)
center(xy)
set (material.color.a ,0.5)
Yellow
#####################################
##Colors
Yellow--> color("#FFFF00")