From TDN
//////////////////////////////////////////////////
// Camera follow
//////////////////////////////////////////////////
if (!isObject(CameraFollow))
{
%template = new BehaviorTemplate(CameraFollow);
%template.friendlyName = "Camera";
%template.behaviorType = "CameraFollow";
%template.description = "Makes the camera follow this object within another object.";
%template.addBehaviorField(objectInfo, "The object to keep camera within to get info from.", object, "", t2dSceneObject);
}
function CameraFollow::onBehaviorAdd(%this)
{
%this.schedule(100, "setWIndowLimit");
sceneWindow2D.startCameraMove();
}
function CameraFollow::setWindowLimit(%this)
{
sceneWindow2D.setViewLimitOn(%this.objectInfo.getArea());
sceneWindow2D.mount(%this.owner);
}