I saw the CityEngine webinar yesterday on “3D Cities for Safety and Security”   and got inspired by their security camera rule, I thought I could do that quite quickly so came up with this:

Here’s the code for those that like this sort of thing (it’s not carefully commented by feel free to modify and share) I’m aware the CityEngine team have something much more sophisticated but for 5 minutes coding I think it’s quite nice:

 

/**
 * File:    camera.cga
 * Created: 19 Dec 2013 16:18:39 GMT
 * Author:  EHartley
 */

version "2013.1"

@Color
attr cameraColor = "#ff00ff"
@Range(0,1)
attr cameraTransparency = 0.5	
@Range(0,360)
attr cameraRotate =0
@Range(0,360)
attr cameraAngle =0
@Range(0,1000)
attr cameraDistance =20
@Range(0,100)
attr cameraHeight = 2.5
@Range(0,100)
attr cameraH = 64
@Range(0,100)
attr cameraW = 48
pyramid = "assets/pyramid.dae"

@StartRule
box-->
	color(cameraColor) set(material.opacity,cameraTransparency)
	//extrude(cameraHeight)
	i("builtin:cube")
	s(cameraH,cameraHeight,cameraW)
	center(xyz)
	comp(f) { top : camera | all : NIL}

camera-->
	//reverseNormals
	roofPyramid(30) s('1,cameraDistance,'1)
	r(0,cameraAngle,cameraRotate)
	center(xyz)
	t(0,-cameraDistance/2,0)

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.