//-----------------------------------------------------------------------------
// Torque Game Builder
// Copyright (C) GarageGames.com, Inc.
// Camera Mount Behavior
// By Jeremy L. Anderson
// Thanks to Magnus Blikstad and Joe Rossi
//-----------------------------------------------------------------------------

if (!isObject(CameraMountBehavior))
{
   %template = new BehaviorTemplate(CameraMountBehavior);
   
   %template.friendlyName = "Mount Camera to This";
   %template.behaviorType = "Effects";
   %template.description  = "Mounts the camera to the current object.";

   %template.addBehaviorField(xMount, "X location in target to mount to.", float, 0);
   %template.addBehaviorField(yMount, "Y location in target to mount to.", float, 0);
   %template.addBehaviorField(mountForce, "Strength of mounting. 0 = rigid", float, 0);
}

function CameraMountBehavior::onAddToScene(%this, %scenegraph)
{

	%this.owner.schedule(1000, "scheduledMount");

}

function CameraMountBehavior::scheduledMount(%this)
{
	echo ("It's on!");
	sceneWindow2D.mount(%this.owner, %this.xMount, %this.yMount, %this.mountForce, true);
}

