camera.cpp

Engine/source/T3D/camera.cpp

More...

Public Defines

define
CameraRadius() 0.05f;
define
MaxPitch() 1.5706f

Public Functions

ConsoleDocClass(Camera , "@brief Represents <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> position, direction and field of view <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/editortool_8cpp/#editortool_8cpp_1a4cb041169a32ea3d4cacadbb955e06b4">render</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> scene <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n\n</a>" "A camera is typically manipulated by <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> GameConnection. When set as the connection 's " "<a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> object, the camera handles all movement actions($mvForwardAction, $mvPitch, etc.) " "just like <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Player.\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Set an already created camera as the <a href="/coding/class/classgameconnection/">GameConnection</a> 's <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "%connection.setControlObject(%camera);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "< h3 >Methods of Operation</h3 >\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "The camera has two general methods of operation. The first is the standard <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> where " "the camera starts and stops its motion and rotation instantly. This is the default operation " "of the camera and is used by most games. It may be specifically set with <a href="/coding/class/classcamera/#classcamera_1a108ac04e35ca44901617f2f219cf3413">Camera::setFlyMode</a>() " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> 6 DoF motion. It is also typically the method used with <a href="/coding/class/classcamera/#classcamera_1a816de828a76d966e71433ab242af929a">Camera::setOrbitMode</a>() or one of " "its helper methods <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit about <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specific object(such as the <a href="/coding/class/classplayer/">Player</a> 's dead body) or <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> " "specific <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n\n</a>" "The second method goes under the name of Newton as it follows Newton 's 2nd law of " "motion:F , either use <a href="/coding/class/classcamera/#classcamera_1ae7aea5163c2bc4e036f7c671f41bf663">Camera::setNewtonFlyMode</a>() or set " "the Camera::newtonMode field <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true. To activate this method <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> rotation, set the Camera::newtonRotation " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true. This method of operation is not typically used in games, and was developed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> allow " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> smooth fly through of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> game level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> recording <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> demo video. But with the right force " "and drag settings, it may give <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> more organic feel <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> games that use an overhead view, " "such as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">RTS.\n\n</a>" "There is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> third, minor method of operation but it is not generally used <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> games. This is when the " "camera is used with Torque 's <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> Editor in Edit Orbit Mode. When set, this allows the camera " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> rotate about <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specific point in the world, and move towards and away from this point. See " "<a href="/coding/class/classcamera/#classcamera_1a5edbb3a6d8633f23cf51c38e36c33cfd">Camera::setEditOrbitMode</a>() and <a href="/coding/class/classcamera/#classcamera_1af3ce1014d0c4bd024e0afc5f1721d931">Camera::setEditOrbitPoint</a>(). While in this mode, <a href="/coding/class/classcamera/#classcamera_1a767e00b5230046cc28a03971d2bee294">Camera::autoFitRadius</a>() " "may also be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">used.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Create <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> camera in the level and set its position <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given spawn <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "//Note:The camera starts in the standard fly <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mode.\n</a>" "% cam, the <a href="/coding/class/classcamera/">Camera</a> may be set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> one of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> number " "of motion modes. These motion modes determine how the camera will respond <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> input " "and may be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> constrain how the <a href="/coding/class/classcamera/">Camera</a> moves. The <a href="/coding/class/classcamera/#classcamera_1a9baf69a7d44d742ea64a377b7b497918">CameraMotionMode</a> enumeration " "defines the possible set of modes and the <a href="/coding/class/classcamera/">Camera</a> 's current may be obtained by using " "getMode().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "Some of the motion modes may be set using specific script methods. These often provide " "additional parameters <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set up the <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> in one go. Otherwise, it is always possible <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "set <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classcamera/">Camera</a> 's motion <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> using the controlMode property. Just pass in the name of the " "<a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> enum. The following table lists the motion modes, how <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set them up, and what they <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offer:\n\n</a>" "< table border='1' cellpadding='1'>" "< tr >< th >Mode</th >< th >Set From Script</th >< th ><a href="/coding/class/classinput/">Input</a> <a href="/coding/class/structmove/">Move</a></th >< th ><a href="/coding/class/classinput/">Input</a> Rotate</th >< th >Can Use Newton Mode?</th ></tr >" "< tr >< td >Stationary</td >< td >controlMode property</td >< td >No</td >< td >No</td >< td >No</td ></tr >" "< tr >< td >FreeRotate</td >< td >controlMode property</td >< td >No</td >< td >Yes</td >< td >Rotate Only</td ></tr >" "< tr >< td >Fly</td >< td >setFlyMode()</td >< td >Yes</td >< td >Yes</td >< td >Yes</td ></tr >" "< tr >< td >OrbitObject</td >< td >setOrbitMode()</td >< td >Orbits object</td >< td >Points <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> object</td >< td ><a href="/coding/class/structmove/">Move</a> only</td ></tr >" "< tr >< td >OrbitPoint</td >< td >setOrbitPoint()</td >< td >Orbits point</td >< td >Points <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> location</td >< td ><a href="/coding/class/structmove/">Move</a> only</td ></tr >" "< tr >< td >TrackObject</td >< td >setTrackObject()</td >< td >No</td >< td >Points <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> object</td >< td >Yes</td ></tr >" "< tr >< td >Overhead</td >< td >controlMode property</td >< td >Yes</td >< td >No</td >< td >Yes</td ></tr >" "< tr >< td >EditOrbit(object selected)</td >< td >setEditOrbitMode()</td >< td >Orbits object</td >< td >Points <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> object</td >< td ><a href="/coding/class/structmove/">Move</a> only</td ></tr >" "< tr >< td >EditOrbit(no object)</td >< td >setEditOrbitMode()</td >< td >Yes</td >< td >Yes</td >< td >Yes</td ></tr >" "</table >\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "< h3 >%<a href="/coding/class/classtrigger/">Trigger</a> <a href="/coding/class/classinput/">Input</a></h3 >\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "Passing <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> move trigger($mvTriggerCount0, $mvTriggerCount1, etc.) on <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classcamera/">Camera</a> performs " "different actions depending on which <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> the camera is in. While in Fly, Overhead or " "EditOrbit mode, either trigger0 or trigger1 will cause <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move twice its normal " "movement speed. You can see this in action within the <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> Editor, where holding down the " "left mouse button <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> in mouse look <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a>(right mouse button is also down) causes the <a href="/coding/class/classcamera/">Camera</a> " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">faster.\n\n</a>" "Passing along trigger2 will put the camera into strafe mode. While in this <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Fly, " "FreeRotate or Overhead <a href="/coding/class/classcamera/">Camera</a> will not rotate from the move input. Instead the yaw motion " "will be applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/class/classcamera/">Camera</a> 's x motion, and the pitch motion will be applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/class/classcamera/">Camera</a> 's " "z motion. You can see this in action within the <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> Editor where holding down the middle mouse " "button allows the user <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move the camera up, down and side-<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a>-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">side.\n\n</a>" "While the camera is operating in Newton Mode, trigger0 and trigger1 behave slightly differently. " "Here trigger0 activates <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> multiplier <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the applied acceleration force as defined by speedMultiplier. " "This has the affect of making the camera move up <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> speed faster. trigger1 has the opposite affect " "by acting as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> brake. When trigger1 is active <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> multiplier is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/class/classcamera/">Camera</a> 's drag as " "defined by <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">brakeMultiplier.\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">CameraData\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">CameraMotionMode\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Camera::movementSpeed\n\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">BaseCamera\n</a>" )
ConsoleDocClass(CameraData , "@brief A datablock that describes <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "datablock <a href="/coding/class/classcameradata/">CameraData</a>(Observer)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> = \"Observer\";\n" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Camera\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablock_Networking\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">BaseCamera\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablocks\n</a>" )
DefineEngineMethod(Camera , autoFitRadius , void , (F32 radius) , "Move the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> fully view the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">radius.\n\n</a>" "@note For this operation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> take affect <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> valid edit orbit point must first be specified. See <a href="/coding/class/classcamera/#classcamera_1af3ce1014d0c4bd024e0afc5f1721d931">Camera::setEditOrbitPoint</a>().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param radius The radius <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> view." )
DefineEngineMethod(Camera , getAngularVelocity , VectorF , () , "Get the angular velocity <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@returns The angular velocity in the form of \"x y z\".\n" "@note Only returns useful results when Camera::newtonRotation is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true." )
DefineEngineMethod(Camera , getMode , Camera::CameraMotionMode , () , "Returns the current camera <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mode.\n\n</a>" "@see <a href="/coding/class/classcamera/#classcamera_1a9baf69a7d44d742ea64a377b7b497918">CameraMotionMode</a>" )
DefineEngineMethod(Camera , getOffset , Point3F , () , "Get the camera's offset from its orbit or tracking <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n\n</a>" "The offset is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position when set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">CameraMode::OrbitObject.\n</a>" "@returns The offset in the form of \"x y z\"." )
DefineEngineMethod(Camera , getPosition , Point3F , () , "Get the camera's position in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">world.\n\n</a>" "@returns The position in the form of \"x y z\"." )
DefineEngineMethod(Camera , getRotation , Point3F , () , "Get the camera's Euler rotation in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">radians.\n\n</a>" "@returns The rotation in radians in the form of \"x y z\"." )
DefineEngineMethod(Camera , getVelocity , VectorF , () , "Get the velocity <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@returns The camera's velocity in the form of \"x y z\"." "@note Only useful when the <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )
DefineEngineMethod(Camera , isEditOrbitMode , bool , () , "Is the camera in edit orbit <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a>?\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@returns true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the camera is in edit orbit mode." )
DefineEngineMethod(Camera , isRotationDamped , bool , () , "Is this <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton Fly <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> camera with damped rotation?\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@returns true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the camera uses <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> damped rotation. i.e. Camera::newtonRotation is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true.\n</a>" )
DefineEngineMethod(Camera , lookAt , void , (Point3F point) , "Point the camera at the specified position. Does not work in Orbit or Track <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modes.\n\n</a>" "@param point The position <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> point the camera at." )
DefineEngineMethod(Camera , setAngularDrag , void , (F32 drag) , "Set the angular drag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param drag The angular drag applied <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> the camera is rotating." "@note Only takes affect when Camera::newtonRotation is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true." )
DefineEngineMethod(Camera , setAngularForce , void , (F32 force) , "Set the angular force <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param force The angular force applied when attempting <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> rotate the camera." "@note Only takes affect when Camera::newtonRotation is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true." )
DefineEngineMethod(Camera , setAngularVelocity , void , (VectorF velocity) , "Set the angular velocity <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param velocity The angular velocity infor form of \"x y z\".\n" "@note Only takes affect when Camera::newtonRotation is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true." )
DefineEngineMethod(Camera , setBrakeMultiplier , void , (F32 multiplier) , "Set the Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> camera brake multiplier when trigger is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">active.\n\n</a>" "@param multiplier The brake multiplier <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> apply." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )
DefineEngineMethod(Camera , setDrag , void , (F32 drag) , "Set the drag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param drag The drag applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> moving." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )
DefineEngineMethod(Camera , setEditOrbitMode , void , () , "Set the editor camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> point set with <a href="/coding/class/classcamera/#classcamera_1af3ce1014d0c4bd024e0afc5f1721d931">Camera::setEditOrbitPoint</a>().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@note This method is generally used only within the <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> Editor and other tools. To " "orbit about an object or point within <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> game, see <a href="/coding/class/classcamera/#classcamera_1a816de828a76d966e71433ab242af929a">Camera::setOrbitMode</a>() and its helper <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">methods.\n</a>" )
DefineEngineMethod(Camera , setEditOrbitPoint , void , (Point3F point) , "Set the editor camera's orbit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n\n</a>" "@param point The point the camera will orbit in the form of \"x y z\"." )
DefineEngineMethod(Camera , setFlyForce , void , (F32 force) , "Set the force applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> camera <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">moving.\n\n</a>" "@param force The force applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> attempting <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )
DefineEngineMethod(Camera , setFlyMode , void , () , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> fly <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">freely.\n\n</a>" "Allows the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> have 6 degrees of freedom. Provides <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> instantaneous motion " "and rotation unless one of the Newton fields has been set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true. See Camera::newtonMode " "and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Camera::newtonRotation.\n</a>" )
DefineEngineMethod(Camera , setMass , void , (F32 mass) , "Set the mass <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param mass The mass used during ease-in and ease-out calculations." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )
DefineEngineMethod(Camera , setNewtonFlyMode , void , () , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> fly freely, but with ease-in and ease-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">out.\n\n</a>" "This method allows <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the same 6 degrees of freedom as <a href="/coding/class/classcamera/#classcamera_1a108ac04e35ca44901617f2f219cf3413">Camera::setFlyMode</a>() but " "activates the ease-in and ease-out on the camera 's movement. To also activate " "Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the camera 's rotation, set Camera::newtonRotation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true." )
DefineEngineMethod(Camera , setOffset , void , (Point3F offset) , "Set the camera's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offset.\n\n</a>" "The offset is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position when set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">CameraMode::OrbitObject.\n</a>" "@param offset The distance <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> offset the camera by in the form of \"x y z\"." )
DefineEngineMethod(Camera , setOrbitMode , void , (GameBase *orbitObject, TransformF orbitPoint, F32 minDistance, F32 maxDistance, F32 initDistance, bool ownClientObj, Point3F offset, bool locked) , (false, Point3F::Zero, false) , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around the given object, or <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> none is given, around the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n\n</a>" " @param orbitObject The object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around. If no object is given(0 or blank string is passed in) use the orbitPoint <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">instead\n</a>" " @param orbitPoint The point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around when no object is given. In the form of \"x y z ax ay az aa\" such as returned by <a href="/coding/class/classsceneobject/#classsceneobject_1ac8ee2e9706e1a0d2505e35789c41a243">SceneObject::getTransform</a>().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param minDistance The minimum distance allowed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param maxDistance The maximum distance allowed from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param initDistance The initial distance from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param ownClientObj  Are we orbiting an object that is owned by us? Default is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">false.\n</a>" "@param offset  An offset added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position. Default is no <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offset.\n</a>" "@param locked  Indicates the camera does not receive input from the player. Default is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">false.\n</a>" "@see Camera::setOrbitObject()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see Camera::setOrbitPoint()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(Camera , setOrbitObject , bool , (GameBase *orbitObject, VectorF rotation, F32 minDistance, F32 maxDistance, F32 initDistance, bool ownClientObject, Point3F offset, bool locked) , (false, Point3F::Zero, false) , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param orbitObject The object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">around.\n</a>" "@param rotation The initial camera rotation about the object in radians in the form of \"x y z\".\n" "@param minDistance The minimum distance allowed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param maxDistance The maximum distance allowed from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param initDistance The initial distance from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param ownClientObject  Are we orbiting an object that is owned by us? Default is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">false.\n</a>" "@param offset  An offset added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position. Default is no <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offset.\n</a>" "@param locked  Indicates the camera does not receive input from the player. Default is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">false.\n</a>" "@returns false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the given object could not be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" "@see <a href="/coding/class/classcamera/#classcamera_1a816de828a76d966e71433ab242af929a">Camera::setOrbitMode</a>()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(Camera , setOrbitPoint , void , (TransformF orbitPoint, F32 minDistance, F32 maxDistance, F32 initDistance, Point3F offset, bool locked) , (Point3F::Zero, false) , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n\n</a>" "@param orbitPoint The point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around. In the form of \"x y z ax ay az aa\" such as returned by <a href="/coding/class/classsceneobject/#classsceneobject_1ac8ee2e9706e1a0d2505e35789c41a243">SceneObject::getTransform</a>().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param minDistance The minimum distance allowed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param maxDistance The maximum distance allowed from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param initDistance The initial distance from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param offset  An offset added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position. Default is no <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offset.\n</a>" "@param locked  Indicates the camera does not receive input from the player. Default is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">false.\n</a>" "@see <a href="/coding/class/classcamera/#classcamera_1a816de828a76d966e71433ab242af929a">Camera::setOrbitMode</a>()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )
DefineEngineMethod(Camera , setRotation , void , (Point3F rot) , "Set the camera's Euler rotation in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">radians.\n\n</a>" "@param rot The rotation in radians in the form of \"x y z\"." "@note Rotation around the Y axis is ignored" )
DefineEngineMethod(Camera , setSpeedMultiplier , void , (F32 multiplier) , "Set the Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> camera speed multiplier when trigger is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">active.\n\n</a>" "@param multiplier The speed multiplier <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> apply." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )
DefineEngineMethod(Camera , setTrackObject , bool , (GameBase *trackObject, Point3F offset) , (Point3F::Zero) , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> track <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param trackObject The object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">track.\n</a>" "@param offset  An offset added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position. Default is no <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offset.\n</a>" "@returns false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the given object could not be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" )
DefineEngineMethod(Camera , setValidEditOrbitPoint , void , (bool validPoint) , "Set <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> there is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> valid editor camera orbit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "When validPoint is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> false the <a href="/coding/class/classcamera/">Camera</a> operates as <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it is " "in Fly <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> rather than an Orbit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mode.\n\n</a>" "@param validPoint Indicates the validity of the orbit point." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Edit Orbit Mode." )
DefineEngineMethod(Camera , setVelocity , void , (VectorF velocity) , "Set the velocity <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param velocity The camera's velocity in the form of \"x y z\"." "@note Only affects the <a href="/coding/class/classcamera/">Camera</a> when in Newton mode." )
ImplementEnumType(CameraMotionMode , "Movement behavior type <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Camera.\n\n</a>" "@ingroup BaseCamera" )

Detailed Description

Public Defines

CameraRadius() 0.05f;
MaxPitch() 1.5706f

Public Functions

clampPitchAngle(F32 & pitch)

ConsoleDocClass(Camera , "@brief Represents <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> position, direction and field of view <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/editortool_8cpp/#editortool_8cpp_1a4cb041169a32ea3d4cacadbb955e06b4">render</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> scene <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">from.\n\n</a>" "A camera is typically manipulated by <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> GameConnection. When set as the connection 's " "<a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> object, the camera handles all movement actions($mvForwardAction, $mvPitch, etc.) " "just like <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Player.\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Set an already created camera as the <a href="/coding/class/classgameconnection/">GameConnection</a> 's <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object\n</a>" "%connection.setControlObject(%camera);\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n\n</a>" "< h3 >Methods of Operation</h3 >\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "The camera has two general methods of operation. The first is the standard <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> where " "the camera starts and stops its motion and rotation instantly. This is the default operation " "of the camera and is used by most games. It may be specifically set with <a href="/coding/class/classcamera/#classcamera_1a108ac04e35ca44901617f2f219cf3413">Camera::setFlyMode</a>() " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> 6 DoF motion. It is also typically the method used with <a href="/coding/class/classcamera/#classcamera_1a816de828a76d966e71433ab242af929a">Camera::setOrbitMode</a>() or one of " "its helper methods <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit about <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specific object(such as the <a href="/coding/class/classplayer/">Player</a> 's dead body) or <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> " "specific <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n\n</a>" "The second method goes under the name of Newton as it follows Newton 's 2nd law of " "motion:F , either use <a href="/coding/class/classcamera/#classcamera_1ae7aea5163c2bc4e036f7c671f41bf663">Camera::setNewtonFlyMode</a>() or set " "the Camera::newtonMode field <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true. To activate this method <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> rotation, set the Camera::newtonRotation " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true. This method of operation is not typically used in games, and was developed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> allow " "<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> smooth fly through of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> game level <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> recording <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> demo video. But with the right force " "and drag settings, it may give <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> more organic feel <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> games that use an overhead view, " "such as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">RTS.\n\n</a>" "There is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> third, minor method of operation but it is not generally used <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> games. This is when the " "camera is used with Torque 's <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> Editor in Edit Orbit Mode. When set, this allows the camera " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> rotate about <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specific point in the world, and move towards and away from this point. See " "<a href="/coding/class/classcamera/#classcamera_1a5edbb3a6d8633f23cf51c38e36c33cfd">Camera::setEditOrbitMode</a>() and <a href="/coding/class/classcamera/#classcamera_1af3ce1014d0c4bd024e0afc5f1721d931">Camera::setEditOrbitPoint</a>(). While in this mode, <a href="/coding/class/classcamera/#classcamera_1a767e00b5230046cc28a03971d2bee294">Camera::autoFitRadius</a>() " "may also be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">used.\n\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Create <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> camera in the level and set its position <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given spawn <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "//Note:The camera starts in the standard fly <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mode.\n</a>" "% cam, the <a href="/coding/class/classcamera/">Camera</a> may be set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> one of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> number " "of motion modes. These motion modes determine how the camera will respond <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> input " "and may be used <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> constrain how the <a href="/coding/class/classcamera/">Camera</a> moves. The <a href="/coding/class/classcamera/#classcamera_1a9baf69a7d44d742ea64a377b7b497918">CameraMotionMode</a> enumeration " "defines the possible set of modes and the <a href="/coding/class/classcamera/">Camera</a> 's current may be obtained by using " "getMode().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "Some of the motion modes may be set using specific script methods. These often provide " "additional parameters <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set up the <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> in one go. Otherwise, it is always possible <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> " "set <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classcamera/">Camera</a> 's motion <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> using the controlMode property. Just pass in the name of the " "<a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> enum. The following table lists the motion modes, how <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> set them up, and what they <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offer:\n\n</a>" "< table border='1' cellpadding='1'>" "< tr >< th >Mode</th >< th >Set From Script</th >< th ><a href="/coding/class/classinput/">Input</a> <a href="/coding/class/structmove/">Move</a></th >< th ><a href="/coding/class/classinput/">Input</a> Rotate</th >< th >Can Use Newton Mode?</th ></tr >" "< tr >< td >Stationary</td >< td >controlMode property</td >< td >No</td >< td >No</td >< td >No</td ></tr >" "< tr >< td >FreeRotate</td >< td >controlMode property</td >< td >No</td >< td >Yes</td >< td >Rotate Only</td ></tr >" "< tr >< td >Fly</td >< td >setFlyMode()</td >< td >Yes</td >< td >Yes</td >< td >Yes</td ></tr >" "< tr >< td >OrbitObject</td >< td >setOrbitMode()</td >< td >Orbits object</td >< td >Points <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> object</td >< td ><a href="/coding/class/structmove/">Move</a> only</td ></tr >" "< tr >< td >OrbitPoint</td >< td >setOrbitPoint()</td >< td >Orbits point</td >< td >Points <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> location</td >< td ><a href="/coding/class/structmove/">Move</a> only</td ></tr >" "< tr >< td >TrackObject</td >< td >setTrackObject()</td >< td >No</td >< td >Points <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> object</td >< td >Yes</td ></tr >" "< tr >< td >Overhead</td >< td >controlMode property</td >< td >Yes</td >< td >No</td >< td >Yes</td ></tr >" "< tr >< td >EditOrbit(object selected)</td >< td >setEditOrbitMode()</td >< td >Orbits object</td >< td >Points <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> object</td >< td ><a href="/coding/class/structmove/">Move</a> only</td ></tr >" "< tr >< td >EditOrbit(no object)</td >< td >setEditOrbitMode()</td >< td >Yes</td >< td >Yes</td >< td >Yes</td ></tr >" "</table >\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "< h3 >%<a href="/coding/class/classtrigger/">Trigger</a> <a href="/coding/class/classinput/">Input</a></h3 >\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "Passing <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> move trigger($mvTriggerCount0, $mvTriggerCount1, etc.) on <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/class/classcamera/">Camera</a> performs " "different actions depending on which <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> the camera is in. While in Fly, Overhead or " "EditOrbit mode, either trigger0 or trigger1 will cause <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move twice its normal " "movement speed. You can see this in action within the <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> Editor, where holding down the " "left mouse button <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> in mouse look <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a>(right mouse button is also down) causes the <a href="/coding/class/classcamera/">Camera</a> " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">faster.\n\n</a>" "Passing along trigger2 will put the camera into strafe mode. While in this <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Fly, " "FreeRotate or Overhead <a href="/coding/class/classcamera/">Camera</a> will not rotate from the move input. Instead the yaw motion " "will be applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/class/classcamera/">Camera</a> 's x motion, and the pitch motion will be applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/class/classcamera/">Camera</a> 's " "z motion. You can see this in action within the <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> Editor where holding down the middle mouse " "button allows the user <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move the camera up, down and side-<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a>-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">side.\n\n</a>" "While the camera is operating in Newton Mode, trigger0 and trigger1 behave slightly differently. " "Here trigger0 activates <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> multiplier <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the applied acceleration force as defined by speedMultiplier. " "This has the affect of making the camera move up <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> speed faster. trigger1 has the opposite affect " "by acting as <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> brake. When trigger1 is active <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> multiplier is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/class/classcamera/">Camera</a> 's drag as " "defined by <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">brakeMultiplier.\n\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">CameraData\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">CameraMotionMode\n</a>" " @see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Camera::movementSpeed\n\n</a>" " @ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">BaseCamera\n</a>" )

ConsoleDocClass(CameraData , "@brief A datablock that describes <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "datablock <a href="/coding/class/classcameradata/">CameraData</a>(Observer)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "{\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "   <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> = \"Observer\";\n" "};\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" "@see <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Camera\n\n</a>" "@ref <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablock_Networking\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">BaseCamera\n</a>" "@ingroup <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Datablocks\n</a>" )

DefineEngineMethod(Camera , autoFitRadius , void , (F32 radius) , "Move the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> fully view the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">radius.\n\n</a>" "@note For this operation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> take affect <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> valid edit orbit point must first be specified. See <a href="/coding/class/classcamera/#classcamera_1af3ce1014d0c4bd024e0afc5f1721d931">Camera::setEditOrbitPoint</a>().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param radius The radius <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> view." )

DefineEngineMethod(Camera , getAngularVelocity , VectorF , () , "Get the angular velocity <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@returns The angular velocity in the form of \"x y z\".\n" "@note Only returns useful results when Camera::newtonRotation is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true." )

DefineEngineMethod(Camera , getMode , Camera::CameraMotionMode , () , "Returns the current camera <a href="/coding/file/guieditctrl_8cpp/#guieditctrl_8cpp_1abb04e3738c4c5a96b3ade6fa47013a6c">control</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mode.\n\n</a>" "@see <a href="/coding/class/classcamera/#classcamera_1a9baf69a7d44d742ea64a377b7b497918">CameraMotionMode</a>" )

DefineEngineMethod(Camera , getOffset , Point3F , () , "Get the camera's offset from its orbit or tracking <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n\n</a>" "The offset is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position when set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">CameraMode::OrbitObject.\n</a>" "@returns The offset in the form of \"x y z\"." )

DefineEngineMethod(Camera , getPosition , Point3F , () , "Get the camera's position in the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">world.\n\n</a>" "@returns The position in the form of \"x y z\"." )

DefineEngineMethod(Camera , getRotation , Point3F , () , "Get the camera's Euler rotation in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">radians.\n\n</a>" "@returns The rotation in radians in the form of \"x y z\"." )

DefineEngineMethod(Camera , getVelocity , VectorF , () , "Get the velocity <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@returns The camera's velocity in the form of \"x y z\"." "@note Only useful when the <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )

DefineEngineMethod(Camera , isEditOrbitMode , bool , () , "Is the camera in edit orbit <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a>?\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@returns true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the camera is in edit orbit mode." )

DefineEngineMethod(Camera , isRotationDamped , bool , () , "Is this <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton Fly <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> camera with damped rotation?\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@returns true <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the camera uses <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> damped rotation. i.e. Camera::newtonRotation is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">true.\n</a>" )

DefineEngineMethod(Camera , lookAt , void , (Point3F point) , "Point the camera at the specified position. Does not work in Orbit or Track <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">modes.\n\n</a>" "@param point The position <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> point the camera at." )

DefineEngineMethod(Camera , setAngularDrag , void , (F32 drag) , "Set the angular drag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param drag The angular drag applied <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> the camera is rotating." "@note Only takes affect when Camera::newtonRotation is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true." )

DefineEngineMethod(Camera , setAngularForce , void , (F32 force) , "Set the angular force <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param force The angular force applied when attempting <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> rotate the camera." "@note Only takes affect when Camera::newtonRotation is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true." )

DefineEngineMethod(Camera , setAngularVelocity , void , (VectorF velocity) , "Set the angular velocity <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param velocity The angular velocity infor form of \"x y z\".\n" "@note Only takes affect when Camera::newtonRotation is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true." )

DefineEngineMethod(Camera , setBrakeMultiplier , void , (F32 multiplier) , "Set the Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> camera brake multiplier when trigger is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">active.\n\n</a>" "@param multiplier The brake multiplier <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> apply." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )

DefineEngineMethod(Camera , setDrag , void , (F32 drag) , "Set the drag <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param drag The drag applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> moving." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )

DefineEngineMethod(Camera , setEditOrbitMode , void , () , "Set the editor camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> point set with <a href="/coding/class/classcamera/#classcamera_1af3ce1014d0c4bd024e0afc5f1721d931">Camera::setEditOrbitPoint</a>().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n\n</a>" "@note This method is generally used only within the <a href="/coding/file/gizmo_8h/#gizmo_8h_1a10fcd3bee2ea25191e31795e36bdeba1a81f4537631c9ab219ec74de554483adc">World</a> Editor and other tools. To " "orbit about an object or point within <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> game, see <a href="/coding/class/classcamera/#classcamera_1a816de828a76d966e71433ab242af929a">Camera::setOrbitMode</a>() and its helper <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">methods.\n</a>" )

DefineEngineMethod(Camera , setEditOrbitPoint , void , (Point3F point) , "Set the editor camera's orbit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n\n</a>" "@param point The point the camera will orbit in the form of \"x y z\"." )

DefineEngineMethod(Camera , setFlyForce , void , (F32 force) , "Set the force applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> camera <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">moving.\n\n</a>" "@param force The force applied <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a0e48c1f64b558d03d870367324920354">while</a> attempting <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )

DefineEngineMethod(Camera , setFlyMode , void , () , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> fly <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">freely.\n\n</a>" "Allows the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> have 6 degrees of freedom. Provides <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> instantaneous motion " "and rotation unless one of the Newton fields has been set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true. See Camera::newtonMode " "and <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Camera::newtonRotation.\n</a>" )

DefineEngineMethod(Camera , setMass , void , (F32 mass) , "Set the mass <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param mass The mass used during ease-in and ease-out calculations." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )

DefineEngineMethod(Camera , setNewtonFlyMode , void , () , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> fly freely, but with ease-in and ease-<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">out.\n\n</a>" "This method allows <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the same 6 degrees of freedom as <a href="/coding/class/classcamera/#classcamera_1a108ac04e35ca44901617f2f219cf3413">Camera::setFlyMode</a>() but " "activates the ease-in and ease-out on the camera 's movement. To also activate " "Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the camera 's rotation, set Camera::newtonRotation <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> true." )

DefineEngineMethod(Camera , setOffset , void , (Point3F offset) , "Set the camera's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offset.\n\n</a>" "The offset is added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position when set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">CameraMode::OrbitObject.\n</a>" "@param offset The distance <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> offset the camera by in the form of \"x y z\"." )

DefineEngineMethod(Camera , setOrbitMode , void , (GameBase *orbitObject, TransformF orbitPoint, F32 minDistance, F32 maxDistance, F32 initDistance, bool ownClientObj, Point3F offset, bool locked) , (false, Point3F::Zero, false) , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around the given object, or <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> none is given, around the given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n\n</a>" " @param orbitObject The object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around. If no object is given(0 or blank string is passed in) use the orbitPoint <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">instead\n</a>" " @param orbitPoint The point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around when no object is given. In the form of \"x y z ax ay az aa\" such as returned by <a href="/coding/class/classsceneobject/#classsceneobject_1ac8ee2e9706e1a0d2505e35789c41a243">SceneObject::getTransform</a>().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param minDistance The minimum distance allowed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param maxDistance The maximum distance allowed from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param initDistance The initial distance from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param ownClientObj  Are we orbiting an object that is owned by us? Default is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">false.\n</a>" "@param offset  An offset added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position. Default is no <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offset.\n</a>" "@param locked  Indicates the camera does not receive input from the player. Default is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">false.\n</a>" "@see Camera::setOrbitObject()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@see Camera::setOrbitPoint()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(Camera , setOrbitObject , bool , (GameBase *orbitObject, VectorF rotation, F32 minDistance, F32 maxDistance, F32 initDistance, bool ownClientObject, Point3F offset, bool locked) , (false, Point3F::Zero, false) , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param orbitObject The object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">around.\n</a>" "@param rotation The initial camera rotation about the object in radians in the form of \"x y z\".\n" "@param minDistance The minimum distance allowed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param maxDistance The maximum distance allowed from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param initDistance The initial distance from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param ownClientObject  Are we orbiting an object that is owned by us? Default is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">false.\n</a>" "@param offset  An offset added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position. Default is no <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offset.\n</a>" "@param locked  Indicates the camera does not receive input from the player. Default is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">false.\n</a>" "@returns false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the given object could not be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" "@see <a href="/coding/class/classcamera/#classcamera_1a816de828a76d966e71433ab242af929a">Camera::setOrbitMode</a>()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(Camera , setOrbitPoint , void , (TransformF orbitPoint, F32 minDistance, F32 maxDistance, F32 initDistance, Point3F offset, bool locked) , (Point3F::Zero, false) , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n\n</a>" "@param orbitPoint The point <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> orbit around. In the form of \"x y z ax ay az aa\" such as returned by <a href="/coding/class/classsceneobject/#classsceneobject_1ac8ee2e9706e1a0d2505e35789c41a243">SceneObject::getTransform</a>().\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param minDistance The minimum distance allowed <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param maxDistance The maximum distance allowed from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param initDistance The initial distance from the orbit object or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "@param offset  An offset added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position. Default is no <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offset.\n</a>" "@param locked  Indicates the camera does not receive input from the player. Default is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">false.\n</a>" "@see <a href="/coding/class/classcamera/#classcamera_1a816de828a76d966e71433ab242af929a">Camera::setOrbitMode</a>()\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" )

DefineEngineMethod(Camera , setRotation , void , (Point3F rot) , "Set the camera's Euler rotation in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">radians.\n\n</a>" "@param rot The rotation in radians in the form of \"x y z\"." "@note Rotation around the Y axis is ignored" )

DefineEngineMethod(Camera , setSpeedMultiplier , void , (F32 multiplier) , "Set the Newton <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> camera speed multiplier when trigger is <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">active.\n\n</a>" "@param multiplier The speed multiplier <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> apply." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Newton mode." )

DefineEngineMethod(Camera , setTrackObject , bool , (GameBase *trackObject, Point3F offset) , (Point3F::Zero) , "Set the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> track <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> given <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">object.\n\n</a>" "@param trackObject The object <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">track.\n</a>" "@param offset  An offset added <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the camera's position. Default is no <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">offset.\n</a>" "@returns false <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the given object could not be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">found.\n</a>" )

DefineEngineMethod(Camera , setValidEditOrbitPoint , void , (bool validPoint) , "Set <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> there is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> valid editor camera orbit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">point.\n</a>" "When validPoint is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> false the <a href="/coding/class/classcamera/">Camera</a> operates as <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> it is " "in Fly <a href="/coding/file/zipobject_8cpp/#zipobject_8cpp_1ac6c3dfb4c3a68f849f32cbfb21da4e77">mode</a> rather than an Orbit <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">mode.\n\n</a>" "@param validPoint Indicates the validity of the orbit point." "@note Only used when <a href="/coding/class/classcamera/">Camera</a> is in Edit Orbit Mode." )

DefineEngineMethod(Camera , setVelocity , void , (VectorF velocity) , "Set the velocity <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n\n</a>" "@param velocity The camera's velocity in the form of \"x y z\"." "@note Only affects the <a href="/coding/class/classcamera/">Camera</a> when in Newton mode." )

IMPLEMENT_CO_DATABLOCK_V1(CameraData )

IMPLEMENT_CO_NETOBJECT_V1(Camera )

ImplementEnumType(CameraMotionMode , "Movement behavior type <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Camera.\n\n</a>" "@ingroup BaseCamera" )

   1
   2//-----------------------------------------------------------------------------
   3// Copyright (c) 2012 GarageGames, LLC
   4//
   5// Permission is hereby granted, free of charge, to any person obtaining a copy
   6// of this software and associated documentation files (the "Software"), to
   7// deal in the Software without restriction, including without limitation the
   8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
   9// sell copies of the Software, and to permit persons to whom the Software is
  10// furnished to do so, subject to the following conditions:
  11//
  12// The above copyright notice and this permission notice shall be included in
  13// all copies or substantial portions of the Software.
  14//
  15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21// IN THE SOFTWARE.
  22//-----------------------------------------------------------------------------
  23
  24#include "platform/platform.h"
  25#include "T3D/camera.h"
  26
  27#include "math/mMath.h"
  28#include "core/stream/bitStream.h"
  29#include "T3D/fx/cameraFXMgr.h"
  30#include "T3D/gameBase/gameConnection.h"
  31#include "math/mathIO.h"
  32#include "gui/worldEditor/editor.h"
  33#include "console/engineAPI.h"
  34#include "console/consoleTypes.h"
  35#include "console/engineAPI.h"
  36#include "math/mathUtils.h"
  37#include "math/mTransform.h"
  38
  39#ifdef TORQUE_EXTENDED_MOVE
  40   #include "T3D/gameBase/extended/extendedMove.h"
  41#endif
  42
  43S32 Camera::smExtendedMovePosRotIndex = 0;  // The ExtendedMove position/rotation index used for camera movements
  44
  45#define MaxPitch 1.5706f
  46#define CameraRadius 0.05f;
  47
  48
  49ImplementEnumType( CameraMotionMode,
  50   "Movement behavior type for Camera.\n\n"
  51   "@ingroup BaseCamera" )
  52   { Camera::StationaryMode,   "Stationary",  "Camera does not rotate or move." },
  53   { Camera::FreeRotateMode,   "FreeRotate",  "Camera may rotate but does not move." },
  54   { Camera::FlyMode,          "Fly",         "Camera may rotate and move freely." },
  55   { Camera::OrbitObjectMode,  "OrbitObject", "Camera orbits about a given object.  Damage flash and white out is determined by the object being orbited.  See Camera::setOrbitMode() to set the orbit object and other parameters." },
  56   { Camera::OrbitPointMode,   "OrbitPoint",  "Camera orbits about a given point.  See Camera::setOrbitMode() to set the orbit point and other parameters." },
  57   { Camera::TrackObjectMode,  "TrackObject", "Camera always faces a given object.  See Camera::setTrackObject() to set the object to track and a distance to remain from the object." },
  58   { Camera::OverheadMode,     "Overhead",    "Camera moves in the XY plane." },
  59   { Camera::EditOrbitMode,    "EditOrbit",   "Used by the World Editor to orbit about a point.  When first activated, the camera is rotated to face the orbit point rather than move to it." }
  60EndImplementEnumType;
  61
  62
  63//=============================================================================
  64//    CameraData.
  65//=============================================================================
  66// MARK: ---- CameraData ----
  67
  68IMPLEMENT_CO_DATABLOCK_V1( CameraData );
  69ConsoleDocClass( CameraData, 
  70   "@brief A datablock that describes a camera.\n\n"
  71
  72   "@tsexample\n"
  73   "datablock CameraData(Observer)\n"
  74   "{\n"
  75   "   mode = \"Observer\";\n"
  76   "};\n"
  77   "@endtsexample\n"
  78
  79   "@see Camera\n\n"
  80   "@ref Datablock_Networking\n"
  81   "@ingroup BaseCamera\n"
  82   "@ingroup Datablocks\n"
  83);
  84
  85//-----------------------------------------------------------------------------
  86
  87void CameraData::initPersistFields()
  88{
  89   Parent::initPersistFields();
  90}
  91
  92//-----------------------------------------------------------------------------
  93
  94void CameraData::packData(BitStream* stream)
  95{
  96   Parent::packData(stream);
  97}
  98
  99//-----------------------------------------------------------------------------
 100
 101void CameraData::unpackData(BitStream* stream)
 102{
 103   Parent::unpackData(stream);
 104}
 105
 106//=============================================================================
 107//    Camera.
 108//=============================================================================
 109// MARK: ---- Camera ----
 110
 111IMPLEMENT_CO_NETOBJECT_V1( Camera );
 112ConsoleDocClass( Camera, 
 113   "@brief Represents a position, direction and field of view to render a scene from.\n\n"
 114
 115   "A camera is typically manipulated by a GameConnection.  When set as the connection's "
 116   "control object, the camera handles all movement actions ($mvForwardAction, $mvPitch, etc.) "
 117   "just like a Player.\n"
 118
 119   "@tsexample\n"
 120   "// Set an already created camera as the GameConnection's control object\n"
 121   "%connection.setControlObject(%camera);\n"
 122   "@endtsexample\n\n"
 123
 124   "<h3>Methods of Operation</h3>\n\n"
 125
 126   "The camera has two general methods of operation.  The first is the standard mode where "
 127   "the camera starts and stops its motion and rotation instantly.  This is the default operation "
 128   "of the camera and is used by most games.  It may be specifically set with Camera::setFlyMode() "
 129   "for 6 DoF motion.  It is also typically the method used with Camera::setOrbitMode() or one of "
 130   "its helper methods to orbit about a specific object (such as the Player's dead body) or a "
 131   "specific point.\n\n"
 132
 133   "The second method goes under the name of Newton as it follows Newton's 2nd law of "
 134   "motion: F=ma.  This provides the camera with an ease-in and ease-out feel for both movement "
 135   "and rotation.  To activate this method for movement, either use Camera::setNewtonFlyMode() or set "
 136   "the Camera::newtonMode field to true.  To activate this method for rotation, set the Camera::newtonRotation "
 137   "to true.  This method of operation is not typically used in games, and was developed to allow "
 138   "for a smooth fly through of a game level while recording a demo video.  But with the right force "
 139   "and drag settings, it may give a more organic feel to the camera to games that use an overhead view, "
 140   "such as a RTS.\n\n"
 141
 142   "There is a third, minor method of operation but it is not generally used for games.  This is when the "
 143   "camera is used with Torque's World Editor in Edit Orbit Mode.  When set, this allows the camera "
 144   "to rotate about a specific point in the world, and move towards and away from this point.  See "
 145   "Camera::setEditOrbitMode() and Camera::setEditOrbitPoint().  While in this mode, Camera::autoFitRadius() "
 146   "may also be used.\n\n"
 147
 148   "@tsexample\n"
 149   "// Create a camera in the level and set its position to a given spawn point.\n"
 150   "// Note: The camera starts in the standard fly mode.\n"
 151   "%cam = new Camera() {\n"
 152   "   datablock = \"Observer\";\n"
 153   "};\n"
 154   "MissionCleanup.add( %cam );\n"
 155   "%cam.setTransform( %spawnPoint.getTransform() );\n"
 156   "@endtsexample\n\n"
 157
 158   "@tsexample\n"
 159   "// Create a camera at the given spawn point for the specified\n"
 160   "// GameConnection i.e. the client.  Uses the standard\n"
 161   "// Sim::spawnObject() function to create the camera using the\n"
 162   "// defined default settings.\n"
 163   "// Note: The camera starts in the standard fly mode.\n"
 164   "function GameConnection::spawnCamera(%this, %spawnPoint)\n"
 165   "{\n"
 166   "   // Set the control object to the default camera\n"
 167   "   if (!isObject(%this.camera))\n"
 168   "   {\n"
 169   "      if (isDefined(\"$Game::DefaultCameraClass\"))\n"
 170   "         %this.camera = spawnObject($Game::DefaultCameraClass, $Game::DefaultCameraDataBlock);\n"
 171   "   }\n"
 172   "\n"
 173   "   // If we have a camera then set up some properties\n"
 174   "   if (isObject(%this.camera))\n"
 175   "   {\n"
 176   "      // Make sure we're cleaned up when the mission ends\n"
 177   "      MissionCleanup.add( %this.camera );\n"
 178   "\n"
 179   "      // Make sure the camera is always in scope for the connection\n"
 180   "      %this.camera.scopeToClient(%this);\n"
 181   "\n"
 182   "      // Send all user input from the connection to the camera\n"
 183   "      %this.setControlObject(%this.camera);\n"
 184   "\n"
 185   "      if (isDefined(\"%spawnPoint\"))\n"
 186   "      {\n"
 187   "         // Attempt to treat %spawnPoint as an object, such as a\n"
 188   "         // SpawnSphere class.\n"
 189   "         if (getWordCount(%spawnPoint) == 1 && isObject(%spawnPoint))\n"
 190   "         {\n"
 191   "            %this.camera.setTransform(%spawnPoint.getTransform());\n"
 192   "         }\n"
 193   "         else\n"
 194   "         {\n"
 195   "            // Treat %spawnPoint as an AngleAxis transform\n"
 196   "            %this.camera.setTransform(%spawnPoint);\n"
 197   "         }\n"
 198   "      }\n"
 199   "   }\n"
 200   "}\n"
 201   "@endtsexample\n\n"
 202
 203   "<h3>Motion Modes</h3>\n\n"
 204
 205   "Beyond the different operation methods, the Camera may be set to one of a number "
 206   "of motion modes.  These motion modes determine how the camera will respond to input "
 207   "and may be used to constrain how the Camera moves.  The CameraMotionMode enumeration "
 208   "defines the possible set of modes and the Camera's current may be obtained by using "
 209   "getMode().\n\n"
 210
 211   "Some of the motion modes may be set using specific script methods.  These often provide "
 212   "additional parameters to set up the mode in one go.  Otherwise, it is always possible to "
 213   "set a Camera's motion mode using the controlMode property.  Just pass in the name of the "
 214   "mode enum.  The following table lists the motion modes, how to set them up, and what they offer:\n\n"
 215
 216   "<table border='1' cellpadding='1'>"
 217   "<tr><th>Mode</th><th>Set From Script</th><th>Input Move</th><th>Input Rotate</th><th>Can Use Newton Mode?</th></tr>"
 218   "<tr><td>Stationary</td><td>controlMode property</td><td>No</td><td>No</td><td>No</td></tr>"
 219   "<tr><td>FreeRotate</td><td>controlMode property</td><td>No</td><td>Yes</td><td>Rotate Only</td></tr>"
 220   "<tr><td>Fly</td><td>setFlyMode()</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>"
 221   "<tr><td>OrbitObject</td><td>setOrbitMode()</td><td>Orbits object</td><td>Points to object</td><td>Move only</td></tr>"
 222   "<tr><td>OrbitPoint</td><td>setOrbitPoint()</td><td>Orbits point</td><td>Points to location</td><td>Move only</td></tr>"
 223   "<tr><td>TrackObject</td><td>setTrackObject()</td><td>No</td><td>Points to object</td><td>Yes</td></tr>"
 224   "<tr><td>Overhead</td><td>controlMode property</td><td>Yes</td><td>No</td><td>Yes</td></tr>"
 225   "<tr><td>EditOrbit (object selected)</td><td>setEditOrbitMode()</td><td>Orbits object</td><td>Points to object</td><td>Move only</td></tr>"
 226   "<tr><td>EditOrbit (no object)</td><td>setEditOrbitMode()</td><td>Yes</td><td>Yes</td><td>Yes</td></tr>"
 227   "</table>\n\n"
 228
 229   "<h3>%Trigger Input</h3>\n\n"
 230
 231   "Passing a move trigger ($mvTriggerCount0, $mvTriggerCount1, etc.) on to a Camera performs "
 232   "different actions depending on which mode the camera is in.  While in Fly, Overhead or "
 233   "EditOrbit mode, either trigger0 or trigger1 will cause a camera to move twice its normal "
 234   "movement speed.  You can see this in action within the World Editor, where holding down the "
 235   "left mouse button while in mouse look mode (right mouse button is also down) causes the Camera "
 236   "to move faster.\n\n"
 237
 238   "Passing along trigger2 will put the camera into strafe mode.  While in this mode a Fly, "
 239   "FreeRotate or Overhead Camera will not rotate from the move input.  Instead the yaw motion "
 240   "will be applied to the Camera's x motion, and the pitch motion will be applied to the Camera's "
 241   "z motion.  You can see this in action within the World Editor where holding down the middle mouse "
 242   "button allows the user to move the camera up, down and side-to-side.\n\n"
 243
 244   "While the camera is operating in Newton Mode, trigger0 and trigger1 behave slightly differently.  "
 245   "Here trigger0 activates a multiplier to the applied acceleration force as defined by speedMultiplier.  "
 246   "This has the affect of making the camera move up to speed faster.  trigger1 has the opposite affect "
 247   "by acting as a brake.  When trigger1 is active a multiplier is added to the Camera's drag as "
 248   "defined by brakeMultiplier.\n\n"
 249
 250   "@see CameraData\n"
 251   "@see CameraMotionMode\n"
 252   "@see Camera::movementSpeed\n\n"
 253   "@ingroup BaseCamera\n"
 254);
 255
 256F32 Camera::smMovementSpeed = 40.0f;
 257
 258//----------------------------------------------------------------------------
 259
 260Camera::Camera()
 261{
 262   mNetFlags.clear(Ghostable);
 263   mTypeMask |= CameraObjectType;
 264   mDataBlock = 0;
 265   mDelta.pos = Point3F(0.0f, 0.0f, 100.0f);
 266   mDelta.rot = Point3F(0.0f, 0.0f, 0.0f);
 267   mDelta.posVec = mDelta.rotVec = VectorF(0.0f, 0.0f, 0.0f);
 268   mObjToWorld.setColumn(3, mDelta.pos);
 269   mRot = mDelta.rot;
 270
 271   mOffset.set(0.0f, 0.0f, 0.0f);
 272
 273   mMinOrbitDist = 0.0f;
 274   mMaxOrbitDist = 0.0f;
 275   mCurOrbitDist = 0.0f;
 276   mOrbitObject = NULL;
 277   mPosition.set(0.0f, 0.0f, 0.0f);
 278   mObservingClientObject = false;
 279   mMode = FlyMode;
 280
 281   mLastAbsoluteYaw = 0.0f;
 282   mLastAbsolutePitch = 0.0f;
 283   mLastAbsoluteRoll = 0.0f;
 284
 285   // For NewtonFlyMode
 286   mNewtonRotation = false;
 287   mAngularVelocity.set(0.0f, 0.0f, 0.0f);
 288   mAngularForce = 100.0f;
 289   mAngularDrag = 2.0f;
 290   mVelocity.set(0.0f, 0.0f, 0.0f);
 291   mNewtonMode = false;
 292   mMass = 10.0f;
 293   mDrag = 2.0;
 294   mFlyForce = 500.0f;
 295   mSpeedMultiplier = 2.0f;
 296   mBrakeMultiplier = 2.0f;
 297
 298   // For EditOrbitMode
 299   mValidEditOrbitPoint = false;
 300   mEditOrbitPoint.set(0.0f, 0.0f, 0.0f);
 301   mCurrentEditOrbitDist = 2.0;
 302
 303   mLocked = false;
 304}
 305
 306//----------------------------------------------------------------------------
 307
 308Camera::~Camera()
 309{
 310}
 311
 312//----------------------------------------------------------------------------
 313
 314bool Camera::onAdd()
 315{
 316   if(!Parent::onAdd() || !mDataBlock)
 317      return false;
 318
 319   mObjBox.maxExtents = mObjScale;
 320   mObjBox.minExtents = mObjScale;
 321   mObjBox.minExtents.neg();
 322   resetWorldBox();
 323
 324   addToScene();
 325
 326   scriptOnAdd();
 327
 328   return true;
 329}
 330
 331//----------------------------------------------------------------------------
 332
 333void Camera::onRemove()
 334{
 335   scriptOnRemove();
 336   removeFromScene();
 337   Parent::onRemove();
 338}
 339
 340//----------------------------------------------------------------------------
 341
 342bool Camera::onNewDataBlock( GameBaseData *dptr, bool reload )
 343{
 344   mDataBlock = dynamic_cast<CameraData*>(dptr);
 345   if ( !mDataBlock || !Parent::onNewDataBlock( dptr, reload ) )
 346      return false;
 347
 348   scriptOnNewDataBlock();
 349
 350   return true;
 351}
 352
 353//----------------------------------------------------------------------------
 354
 355void Camera::onEditorEnable()
 356{
 357   mNetFlags.set(Ghostable);
 358}
 359
 360//----------------------------------------------------------------------------
 361
 362void Camera::onEditorDisable()
 363{
 364   mNetFlags.clear(Ghostable);
 365}
 366
 367//----------------------------------------------------------------------------
 368
 369// check if the object needs to be observed through its own camera...
 370void Camera::getCameraTransform(F32* pos, MatrixF* mat)
 371{
 372   // The camera doesn't support a third person mode,
 373   // so we want to override the default ShapeBase behavior.
 374   ShapeBase * obj = dynamic_cast<ShapeBase*>(static_cast<SimObject*>(mOrbitObject));
 375   if(obj && static_cast<ShapeBaseData*>(obj->getDataBlock())->observeThroughObject)
 376      obj->getCameraTransform(pos, mat);
 377   else
 378      getRenderEyeTransform(mat);
 379
 380   // Apply Camera FX.
 381   mat->mul( gCamFXMgr.getTrans() );
 382}
 383
 384void Camera::getEyeCameraTransform(IDisplayDevice *displayDevice, U32 eyeId, MatrixF *outMat)
 385{
 386   // The camera doesn't support a third person mode,
 387   // so we want to override the default ShapeBase behavior.
 388   ShapeBase * obj = dynamic_cast<ShapeBase*>(static_cast<SimObject*>(mOrbitObject));
 389   if(obj && static_cast<ShapeBaseData*>(obj->getDataBlock())->observeThroughObject)
 390      obj->getEyeCameraTransform(displayDevice, eyeId, outMat);
 391   else
 392   {
 393      Parent::getEyeCameraTransform(displayDevice, eyeId, outMat);
 394   }
 395}
 396
 397//----------------------------------------------------------------------------
 398
 399F32 Camera::getCameraFov()
 400{
 401   ShapeBase * obj = dynamic_cast<ShapeBase*>(static_cast<SimObject*>(mOrbitObject));
 402   if(obj && static_cast<ShapeBaseData*>(obj->getDataBlock())->observeThroughObject)
 403      return(obj->getCameraFov());
 404   else
 405      return(Parent::getCameraFov());
 406}
 407
 408//----------------------------------------------------------------------------
 409
 410F32 Camera::getDefaultCameraFov()
 411{
 412   ShapeBase * obj = dynamic_cast<ShapeBase*>(static_cast<SimObject*>(mOrbitObject));
 413   if(obj && static_cast<ShapeBaseData*>(obj->getDataBlock())->observeThroughObject)
 414      return(obj->getDefaultCameraFov());
 415   else
 416      return(Parent::getDefaultCameraFov());
 417}
 418
 419//----------------------------------------------------------------------------
 420
 421bool Camera::isValidCameraFov(F32 fov)
 422{
 423   ShapeBase * obj = dynamic_cast<ShapeBase*>(static_cast<SimObject*>(mOrbitObject));
 424   if(obj && static_cast<ShapeBaseData*>(obj->getDataBlock())->observeThroughObject)
 425      return(obj->isValidCameraFov(fov));
 426   else
 427      return(Parent::isValidCameraFov(fov));
 428}
 429
 430//----------------------------------------------------------------------------
 431
 432void Camera::setCameraFov(F32 fov)
 433{
 434   ShapeBase * obj = dynamic_cast<ShapeBase*>(static_cast<SimObject*>(mOrbitObject));
 435   if(obj && static_cast<ShapeBaseData*>(obj->getDataBlock())->observeThroughObject)
 436      obj->setCameraFov(fov);
 437   else
 438      Parent::setCameraFov(fov);
 439}
 440
 441//----------------------------------------------------------------------------
 442
 443void clampPitchAngle(F32 &pitch)
 444{
 445   // Clamp pitch to +/-MaxPitch, but allow pitch=PI as it is used by some editor
 446   // views (bottom, front, right)
 447   if ((pitch > MaxPitch) && !mIsEqual(pitch, M_PI_F, 0.001f))
 448      pitch = MaxPitch;
 449   else if (pitch < -MaxPitch)
 450      pitch = -MaxPitch;
 451}
 452
 453//----------------------------------------------------------------------------
 454
 455void Camera::processTick(const Move* move)
 456{
 457   Parent::processTick(move);
 458
 459   if ( isMounted() )
 460   {
 461      // Update SceneContainer.
 462      updateContainer();
 463      return;
 464   }
 465
 466   Point3F vec,pos;
 467   if (move) 
 468   {
 469      bool strafeMode = move->trigger[2];
 470
 471      // If using editor then force camera into fly mode, unless using EditOrbitMode
 472      if(gEditingMission && mMode != FlyMode && mMode != EditOrbitMode)
 473         setFlyMode();
 474
 475      // Massage the mode if we're in EditOrbitMode
 476      CameraMotionMode virtualMode = mMode;
 477      if(mMode == EditOrbitMode)
 478      {
 479         if(!mValidEditOrbitPoint)
 480         {
 481            virtualMode = FlyMode;
 482         }
 483         else
 484         {
 485            // Reset any Newton camera velocities for when we switch
 486            // out of EditOrbitMode.
 487            mNewtonRotation = false;
 488            mVelocity.set(0.0f, 0.0f, 0.0f);
 489            mAngularVelocity.set(0.0f, 0.0f, 0.0f);
 490         }
 491      }
 492
 493      // Update orientation
 494      mDelta.rotVec = mRot;
 495
 496      VectorF rotVec(0, 0, 0);
 497
 498      bool doStandardMove = true;
 499
 500#ifdef TORQUE_EXTENDED_MOVE
 501      GameConnection* con = getControllingClient();
 502
 503      // Work with an absolute rotation from the ExtendedMove class?
 504      if(con && con->getControlSchemeAbsoluteRotation())
 505      {
 506         doStandardMove = false;
 507         const ExtendedMove* emove = dynamic_cast<const ExtendedMove*>(move);
 508         U32 emoveIndex = smExtendedMovePosRotIndex;
 509         if(emoveIndex >= ExtendedMove::MaxPositionsRotations)
 510            emoveIndex = 0;
 511
 512         if(emove->EulerBasedRotation[emoveIndex])
 513         {
 514            if(virtualMode != StationaryMode &&
 515               virtualMode != TrackObjectMode &&
 516               (!mLocked || virtualMode != OrbitObjectMode && virtualMode != OrbitPointMode))
 517            {
 518               // Pitch
 519               mRot.x += (emove->rotX[emoveIndex] - mLastAbsolutePitch);
 520
 521               // Do we also include the relative pitch value?
 522               if(con->getControlSchemeAddPitchToAbsRot() && !strafeMode)
 523               {
 524                  F32 x = move->pitch;
 525                  if (x > M_PI_F)
 526                     x -= M_2PI_F;
 527
 528                  mRot.x += x;
 529               }
 530
 531               // Constrain the range of mRot.x
 532               while (mRot.x < -M_PI_F) 
 533                  mRot.x += M_2PI_F;
 534               while (mRot.x > M_PI_F) 
 535                  mRot.x -= M_2PI_F;
 536
 537               // Yaw
 538               mRot.z += (emove->rotZ[emoveIndex] - mLastAbsoluteYaw);
 539
 540               // Do we also include the relative yaw value?
 541               if(con->getControlSchemeAddYawToAbsRot() && !strafeMode)
 542               {
 543                  F32 z = move->yaw;
 544                  if (z > M_PI_F)
 545                     z -= M_2PI_F;
 546
 547                  mRot.z += z;
 548               }
 549
 550               // Constrain the range of mRot.z
 551               while (mRot.z < -M_PI_F) 
 552                  mRot.z += M_2PI_F;
 553               while (mRot.z > M_PI_F) 
 554                  mRot.z -= M_2PI_F;
 555
 556               mLastAbsoluteYaw = emove->rotZ[emoveIndex];
 557               mLastAbsolutePitch = emove->rotX[emoveIndex];
 558               mLastAbsoluteRoll = emove->rotY[emoveIndex];
 559
 560               // Bank
 561               mRot.y = emove->rotY[emoveIndex];
 562
 563               // Constrain the range of mRot.y
 564               while (mRot.y > M_PI_F) 
 565                  mRot.y -= M_2PI_F;
 566            }
 567         }
 568      }
 569#endif
 570
 571      if(doStandardMove)
 572      {
 573         // process input/determine rotation vector
 574         if(virtualMode != StationaryMode &&
 575            virtualMode != TrackObjectMode &&
 576            (!mLocked || ((virtualMode != OrbitObjectMode) && (virtualMode != OrbitPointMode))))
 577         {
 578            if(!strafeMode)
 579            {
 580               rotVec.x = move->pitch;
 581               rotVec.z = move->yaw;
 582            }
 583         }
 584         else if(virtualMode == TrackObjectMode && bool(mOrbitObject))
 585         {
 586            // orient the camera to face the object
 587            Point3F objPos;
 588            // If this is a shapebase, use its render eye transform
 589            // to avoid jittering.
 590            ShapeBase *shape = dynamic_cast<ShapeBase*>((GameBase*)mOrbitObject);
 591            if( shape != NULL )
 592            {
 593               MatrixF ret;
 594               shape->getRenderEyeTransform( &ret );
 595               objPos = ret.getPosition();
 596            }
 597            else
 598            {
 599               mOrbitObject->getWorldBox().getCenter(&objPos);
 600            }
 601            mObjToWorld.getColumn(3,&pos);
 602            vec = objPos - pos;
 603            vec.normalizeSafe();
 604            F32 pitch, yaw;
 605            MathUtils::getAnglesFromVector(vec, yaw, pitch);
 606            rotVec.x = -pitch - mRot.x;
 607            rotVec.z = yaw - mRot.z;
 608            if(rotVec.z > M_PI_F)
 609               rotVec.z -= M_2PI_F;
 610            else if(rotVec.z < -M_PI_F)
 611               rotVec.z += M_2PI_F;
 612         }
 613
 614         // apply rotation vector according to physics rules
 615         if(mNewtonRotation)
 616         {
 617            const F32 force = mAngularForce;
 618            const F32 drag = mAngularDrag;
 619
 620            VectorF acc(0.0f, 0.0f, 0.0f);
 621
 622            rotVec.x *= 2.0f;   // Assume that our -2PI to 2PI range was clamped to -PI to PI in script
 623            rotVec.z *= 2.0f;   // Assume that our -2PI to 2PI range was clamped to -PI to PI in script
 624
 625            F32 rotVecL = rotVec.len();
 626            if(rotVecL > 0)
 627            {
 628               acc = (rotVec * force / mMass) * TickSec;
 629            }
 630
 631            // Accelerate
 632            mAngularVelocity += acc;
 633
 634            // Drag
 635            mAngularVelocity -= mAngularVelocity * drag * TickSec;
 636
 637            // Rotate
 638            mRot += mAngularVelocity * TickSec;
 639            clampPitchAngle(mRot.x);
 640         }
 641         else
 642         {
 643            mRot.x += rotVec.x;
 644            mRot.z += rotVec.z;
 645            clampPitchAngle(mRot.x);
 646         }
 647      }
 648
 649      // Update position
 650      VectorF posVec(0, 0, 0);
 651      bool mustValidateEyePoint = false;
 652      bool serverInterpolate = false;
 653
 654      // process input/determine translation vector
 655      if(virtualMode == OrbitObjectMode || virtualMode == OrbitPointMode)
 656      {
 657         pos = mDelta.pos;
 658         if(virtualMode == OrbitObjectMode && bool(mOrbitObject)) 
 659         {
 660            // If this is a shapebase, use its render eye transform
 661            // to avoid jittering.
 662            GameBase *castObj = mOrbitObject;
 663            ShapeBase* shape = dynamic_cast<ShapeBase*>(castObj);
 664            if( shape != NULL ) 
 665            {
 666               MatrixF ret;
 667               shape->getRenderEyeTransform( &ret );
 668               mPosition = ret.getPosition();
 669            }
 670            else 
 671            {
 672               // Hopefully this is a static object that doesn't move,
 673               // because the worldbox doesn't get updated between ticks.
 674               mOrbitObject->getWorldBox().getCenter(&mPosition);
 675            }
 676         }
 677
 678         posVec = (mPosition + mOffset) - pos;
 679         mustValidateEyePoint = true;
 680         serverInterpolate = mNewtonMode;
 681      }
 682      else if(virtualMode == EditOrbitMode && mValidEditOrbitPoint)
 683      {
 684         bool faster = move->trigger[0] || move->trigger[1];
 685         F32 scale = smMovementSpeed * (faster + 1);
 686         mCurrentEditOrbitDist -= move->y * TickSec * scale;
 687         mCurrentEditOrbitDist -= move->roll * TickSec * scale;   // roll will be -Pi to Pi and we'll attempt to scale it here to be in line with the move->y calculation above
 688         if(mCurrentEditOrbitDist < 0.0f)
 689            mCurrentEditOrbitDist = 0.0f;
 690
 691         mPosition = mEditOrbitPoint;
 692         _setPosition(mPosition, mRot);
 693         _calcEditOrbitPoint(&mObjToWorld, mRot);
 694         pos = mPosition;
 695      }
 696      else if(virtualMode == FlyMode)
 697      {
 698         bool faster = move->trigger[0] || move->trigger[1];
 699         F32 scale = smMovementSpeed * (faster + 1);
 700
 701         mObjToWorld.getColumn(3,&pos);
 702         mObjToWorld.getColumn(0,&vec);
 703         posVec = vec * move->x * TickSec * scale + vec * (strafeMode ? move->yaw * 2.0f * TickSec * scale : 0.0f);
 704         mObjToWorld.getColumn(1,&vec);
 705         posVec += vec * move->y * TickSec * scale + vec * move->roll * TickSec * scale;
 706         mObjToWorld.getColumn(2,&vec);
 707         posVec += vec * move->z * TickSec * scale - vec * (strafeMode ? move->pitch * 2.0f * TickSec * scale : 0.0f);
 708      }
 709      else if(virtualMode == OverheadMode)
 710      {
 711         bool faster = move->trigger[0] || move->trigger[1];
 712         F32 scale = smMovementSpeed * (faster + 1);
 713
 714         mObjToWorld.getColumn(3,&pos);
 715
 716         mObjToWorld.getColumn(0,&vec);
 717         vec.z = 0;
 718         vec.normalizeSafe();
 719         vec = vec * move->x * TickSec * scale + (strafeMode ? vec * move->yaw * 2.0f * TickSec * scale : Point3F(0, 0, 0));
 720         posVec = vec;
 721
 722         mObjToWorld.getColumn(1,&vec);
 723         vec.z = 0;
 724         if (vec.isZero())
 725         {
 726            mObjToWorld.getColumn(2,&vec);
 727            vec.z = 0;
 728         }
 729         vec.normalizeSafe();
 730         vec = vec * move->y * TickSec * scale - (strafeMode ? vec * move->pitch * 2.0f * TickSec * scale : Point3F(0, 0, 0));
 731         posVec += vec;
 732         posVec.z += move->z * TickSec * scale + move->roll * TickSec * scale;
 733      }
 734      else // ignore input
 735      {
 736         mObjToWorld.getColumn(3,&pos);
 737      }
 738
 739      // apply translation vector according to physics rules
 740      mDelta.posVec = pos;
 741      if(mNewtonMode)
 742      {
 743         bool faster = move->trigger[0];
 744         bool brake = move->trigger[1];
 745
 746         const F32 movementSpeedMultiplier = smMovementSpeed / 40.0f; // Using the starting value as the base
 747         const F32 force = faster ? mFlyForce * movementSpeedMultiplier * mSpeedMultiplier : mFlyForce * movementSpeedMultiplier;
 748         const F32 drag = brake ? mDrag * mBrakeMultiplier : mDrag;
 749
 750         VectorF acc(0.0f, 0.0f, 0.0f);
 751
 752         F32 posVecL = posVec.len();
 753         if(posVecL > 0)
 754         {
 755            acc = (posVec * force / mMass) * TickSec;
 756         }
 757
 758         // Accelerate
 759         mVelocity += acc;
 760
 761         // Drag
 762         mVelocity -= mVelocity * drag * TickSec;
 763
 764         // Move
 765         pos += mVelocity * TickSec;
 766      }
 767      else
 768      {
 769         pos += posVec;
 770      }
 771
 772      _setPosition(pos,mRot);
 773
 774      // If on the client, calc delta for backstepping
 775      if (serverInterpolate || isClientObject())
 776      {
 777         mDelta.pos = pos;
 778         mDelta.rot = mRot;
 779         mDelta.posVec = mDelta.posVec - mDelta.pos;
 780         mDelta.rotVec = mDelta.rotVec - mDelta.rot;
 781         for(U32 i=0; i<3; ++i)
 782         {
 783            if (mDelta.rotVec[i] > M_PI_F)
 784               mDelta.rotVec[i] -= M_2PI_F;
 785            else if (mDelta.rotVec[i] < -M_PI_F)
 786               mDelta.rotVec[i] += M_2PI_F;
 787         }
 788      }
 789
 790      if(mustValidateEyePoint)
 791         _validateEyePoint(1.0f, &mObjToWorld);
 792
 793      setMaskBits(MoveMask);
 794   }
 795
 796   // Need to calculate the orbit position for the editor so the camera position
 797   // doesn't change when switching between orbit and other camera modes
 798   if (isServerObject() && (mMode == EditOrbitMode && mValidEditOrbitPoint))
 799      _calcEditOrbitPoint(&mObjToWorld, mRot);
 800
 801   if(getControllingClient() && mContainer)
 802      updateContainer();
 803}
 804
 805//----------------------------------------------------------------------------
 806
 807void Camera::onDeleteNotify( SimObject* obj )
 808{   
 809   if( obj == mOrbitObject )
 810   {
 811      mOrbitObject = NULL;
 812
 813      if( mMode == OrbitObjectMode )
 814         mMode = OrbitPointMode;
 815   }
 816
 817   Parent::onDeleteNotify( obj );
 818}
 819
 820//----------------------------------------------------------------------------
 821
 822void Camera::interpolateTick(F32 dt)
 823{
 824   Parent::interpolateTick(dt);
 825
 826   if ( isMounted() )
 827      return;
 828
 829   Point3F rot = mDelta.rot + mDelta.rotVec * dt;
 830
 831   if((mMode == OrbitObjectMode || mMode == OrbitPointMode) && !mNewtonMode)
 832   {
 833      if(mMode == OrbitObjectMode && bool(mOrbitObject))
 834      {
 835         // If this is a shapebase, use its render eye transform
 836         // to avoid jittering.
 837         GameBase *castObj = mOrbitObject;
 838         ShapeBase* shape = dynamic_cast<ShapeBase*>(castObj);
 839         if( shape != NULL ) 
 840         {
 841            MatrixF ret;
 842            shape->getRenderEyeTransform( &ret );
 843            mPosition = ret.getPosition();
 844         } 
 845         else 
 846         {
 847            // Hopefully this is a static object that doesn't move,
 848            // because the worldbox doesn't get updated between ticks.
 849            mOrbitObject->getWorldBox().getCenter(&mPosition);
 850         }
 851      }
 852      _setRenderPosition( mPosition + mOffset, rot );
 853      _validateEyePoint( 1.0f, &mRenderObjToWorld );
 854   }
 855   else if(mMode == EditOrbitMode && mValidEditOrbitPoint)
 856   {
 857      mPosition = mEditOrbitPoint;
 858      _setRenderPosition(mPosition, rot);
 859      _calcEditOrbitPoint(&mRenderObjToWorld, rot);
 860   }
 861   else if(mMode == TrackObjectMode && bool(mOrbitObject) && !mNewtonRotation)
 862   {
 863      // orient the camera to face the object
 864      Point3F objPos;
 865      // If this is a shapebase, use its render eye transform
 866      // to avoid jittering.
 867      ShapeBase *shape = dynamic_cast<ShapeBase*>((GameBase*)mOrbitObject);
 868      if( shape != NULL )
 869      {
 870         MatrixF ret;
 871         shape->getRenderEyeTransform( &ret );
 872         objPos = ret.getPosition();
 873      }
 874      else
 875      {
 876         mOrbitObject->getWorldBox().getCenter(&objPos);
 877      }
 878      Point3F pos = mDelta.pos + mDelta.posVec * dt;
 879      Point3F vec = objPos - pos;
 880      vec.normalizeSafe();
 881      F32 pitch, yaw;
 882      MathUtils::getAnglesFromVector(vec, yaw, pitch);
 883      rot.x = -pitch;
 884      rot.z = yaw;
 885      _setRenderPosition(pos, rot);
 886   }
 887   else 
 888   {
 889      Point3F pos = mDelta.pos + mDelta.posVec * dt;
 890      _setRenderPosition(pos,rot);
 891      if(mMode == OrbitObjectMode || mMode == OrbitPointMode)
 892         _validateEyePoint(1.0f, &mRenderObjToWorld);
 893   }
 894}
 895
 896//----------------------------------------------------------------------------
 897
 898void Camera::_setPosition(const Point3F& pos, const Point3F& rot)
 899{
 900   MatrixF xRot, zRot;
 901   xRot.set(EulerF(rot.x, 0.0f, 0.0f));
 902   zRot.set(EulerF(0.0f, 0.0f, rot.z));
 903   
 904   MatrixF temp;
 905
 906   if(mDataBlock && mDataBlock->cameraCanBank)
 907   {
 908      // Take rot.y into account to bank the camera
 909      MatrixF imat;
 910      imat.mul(zRot, xRot);
 911      MatrixF ymat;
 912      ymat.set(EulerF(0.0f, rot.y, 0.0f));
 913      temp.mul(imat, ymat);
 914   }
 915   else
 916   {
 917      temp.mul(zRot, xRot);
 918   }
 919
 920   temp.setColumn(3, pos);
 921   Parent::setTransform(temp);
 922   mRot = rot;
 923}
 924
 925//----------------------------------------------------------------------------
 926
 927void Camera::setRotation(const Point3F& rot)
 928{
 929   MatrixF xRot, zRot;
 930   xRot.set(EulerF(rot.x, 0.0f, 0.0f));
 931   zRot.set(EulerF(0.0f, 0.0f, rot.z));
 932
 933   MatrixF temp;
 934
 935   if(mDataBlock && mDataBlock->cameraCanBank)
 936   {
 937      // Take rot.y into account to bank the camera
 938      MatrixF imat;
 939      imat.mul(zRot, xRot);
 940      MatrixF ymat;
 941      ymat.set(EulerF(0.0f, rot.y, 0.0f));
 942      temp.mul(imat, ymat);
 943   }
 944   else
 945   {
 946      temp.mul(zRot, xRot);
 947   }
 948
 949   temp.setColumn(3, getPosition());
 950   Parent::setTransform(temp);
 951   mRot = rot;
 952}
 953
 954//----------------------------------------------------------------------------
 955
 956void Camera::_setRenderPosition(const Point3F& pos,const Point3F& rot)
 957{
 958   MatrixF xRot, zRot;
 959   xRot.set(EulerF(rot.x, 0, 0));
 960   zRot.set(EulerF(0, 0, rot.z));
 961
 962   MatrixF temp;
 963
 964   // mDataBlock may not be defined yet as this method is called during
 965   // SceneObject::onAdd().
 966   if(mDataBlock && mDataBlock->cameraCanBank)
 967   {
 968      // Take rot.y into account to bank the camera
 969      MatrixF imat;
 970      imat.mul(zRot, xRot);
 971      MatrixF ymat;
 972      ymat.set(EulerF(0.0f, rot.y, 0.0f));
 973      temp.mul(imat, ymat);
 974   }
 975   else
 976   {
 977      temp.mul(zRot, xRot);
 978   }
 979
 980   temp.setColumn(3, pos);
 981   Parent::setRenderTransform(temp);
 982}
 983
 984//----------------------------------------------------------------------------
 985
 986void Camera::writePacketData(GameConnection *connection, BitStream *bstream)
 987{
 988   // Update client regardless of status flags.
 989   Parent::writePacketData(connection, bstream);
 990
 991   Point3F pos;
 992   mObjToWorld.getColumn(3,&pos);
 993   bstream->setCompressionPoint(pos);
 994   mathWrite(*bstream, pos);
 995   bstream->write(mRot.x);
 996   if(mDataBlock && bstream->writeFlag(mDataBlock->cameraCanBank))
 997   {
 998      // Include mRot.y to allow for camera banking
 999      bstream->write(mRot.y);
1000   }
1001   bstream->write(mRot.z);
1002
1003   U32 writeMode = mMode;
1004   Point3F writePos = mPosition;
1005   S32 gIndex = -1;
1006   if(mMode == OrbitObjectMode)
1007   {
1008      gIndex = bool(mOrbitObject) ? connection->getGhostIndex(mOrbitObject): -1;
1009      if(gIndex == -1)
1010      {
1011         writeMode = OrbitPointMode;
1012         if(bool(mOrbitObject))
1013            mOrbitObject->getWorldBox().getCenter(&writePos);
1014      }
1015   }
1016   else if(mMode == TrackObjectMode)
1017   {
1018      gIndex = bool(mOrbitObject) ? connection->getGhostIndex(mOrbitObject): -1;
1019      if(gIndex == -1)
1020         writeMode = StationaryMode;
1021   }
1022   bstream->writeRangedU32(writeMode, CameraFirstMode, CameraLastMode);
1023
1024   if (writeMode == OrbitObjectMode || writeMode == OrbitPointMode)
1025   {
1026      bstream->write(mMinOrbitDist);
1027      bstream->write(mMaxOrbitDist);
1028      bstream->write(mCurOrbitDist);
1029      if(writeMode == OrbitObjectMode)
1030      {
1031         bstream->writeFlag(mObservingClientObject);
1032         bstream->writeInt(gIndex, NetConnection::GhostIdBitSize);
1033      }
1034      if (writeMode == OrbitPointMode)
1035         bstream->writeCompressedPoint(writePos);
1036   }
1037   else if(writeMode == TrackObjectMode)
1038   {
1039      bstream->writeInt(gIndex, NetConnection::GhostIdBitSize);
1040   }
1041
1042   if(bstream->writeFlag(mNewtonMode))
1043   {
1044      bstream->write(mVelocity.x);
1045      bstream->write(mVelocity.y);
1046      bstream->write(mVelocity.z);
1047   }
1048   if(bstream->writeFlag(mNewtonRotation))
1049   {
1050      bstream->write(mAngularVelocity.x);
1051      bstream->write(mAngularVelocity.y);
1052      bstream->write(mAngularVelocity.z);
1053   }
1054
1055   bstream->writeFlag(mValidEditOrbitPoint);
1056   if(writeMode == EditOrbitMode)
1057   {
1058      bstream->write(mEditOrbitPoint.x);
1059      bstream->write(mEditOrbitPoint.y);
1060      bstream->write(mEditOrbitPoint.z);
1061      bstream->write(mCurrentEditOrbitDist);
1062   }
1063}
1064
1065//----------------------------------------------------------------------------
1066
1067void Camera::readPacketData(GameConnection *connection, BitStream *bstream)
1068{
1069   Parent::readPacketData(connection, bstream);
1070   Point3F pos,rot;
1071   mathRead(*bstream, &pos);
1072   bstream->setCompressionPoint(pos);
1073   bstream->read(&rot.x);
1074   if(bstream->readFlag())
1075   {
1076      // Include rot.y to allow for camera banking
1077      bstream->read(&rot.y);
1078   }
1079   bstream->read(&rot.z);
1080
1081   GameBase* obj = 0;
1082   mMode = (CameraMotionMode)bstream->readRangedU32(CameraFirstMode, CameraLastMode);
1083   mObservingClientObject = false;
1084   if (mMode == OrbitObjectMode || mMode == OrbitPointMode)
1085   {
1086      bstream->read(&mMinOrbitDist);
1087      bstream->read(&mMaxOrbitDist);
1088      bstream->read(&mCurOrbitDist);
1089
1090      if(mMode == OrbitObjectMode)
1091      {
1092         mObservingClientObject = bstream->readFlag();
1093         S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize);
1094         obj = static_cast<GameBase*>(connection->resolveGhost(gIndex));
1095      }
1096      if (mMode == OrbitPointMode)
1097         bstream->readCompressedPoint(&mPosition);
1098   }
1099   else if (mMode == TrackObjectMode)
1100   {
1101      S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize);
1102      obj = static_cast<GameBase*>(connection->resolveGhost(gIndex));
1103   }
1104
1105   if (obj != (GameBase*)mOrbitObject)
1106   {
1107      if (mOrbitObject)
1108      {
1109         clearProcessAfter();
1110         clearNotify(mOrbitObject);
1111      }
1112
1113      mOrbitObject = obj;
1114      if (mOrbitObject)
1115      {
1116         processAfter(mOrbitObject);
1117         deleteNotify(mOrbitObject);
1118      }
1119   }
1120
1121   mNewtonMode = bstream->readFlag();
1122   if(mNewtonMode)
1123   {
1124      bstream->read(&mVelocity.x);
1125      bstream->read(&mVelocity.y);
1126      bstream->read(&mVelocity.z);
1127   }
1128
1129   mNewtonRotation = bstream->readFlag();
1130   if(mNewtonRotation)
1131   {
1132      bstream->read(&mAngularVelocity.x);
1133      bstream->read(&mAngularVelocity.y);
1134      bstream->read(&mAngularVelocity.z);
1135   }
1136
1137   mValidEditOrbitPoint = bstream->readFlag();
1138   if(mMode == EditOrbitMode)
1139   {
1140      bstream->read(&mEditOrbitPoint.x);
1141      bstream->read(&mEditOrbitPoint.y);
1142      bstream->read(&mEditOrbitPoint.z);
1143      bstream->read(&mCurrentEditOrbitDist);
1144   }
1145
1146   _setPosition(pos,rot);
1147   // Movement in OrbitObjectMode is not input-based - don't reset interpolation
1148   if(mMode != OrbitObjectMode)
1149   {
1150      mDelta.pos = pos;
1151      mDelta.posVec.set(0.0f, 0.0f, 0.0f);
1152      mDelta.rot = rot;
1153      mDelta.rotVec.set(0.0f, 0.0f, 0.0f);
1154   }
1155}
1156
1157//----------------------------------------------------------------------------
1158
1159U32 Camera::packUpdate(NetConnection *con, U32 mask, BitStream *bstream)
1160{
1161   Parent::packUpdate(con, mask, bstream);
1162
1163   if (bstream->writeFlag(mask & UpdateMask))
1164   {
1165      bstream->writeFlag(mLocked);
1166      mathWrite(*bstream, mOffset);
1167   }
1168
1169   if(bstream->writeFlag(mask & NewtonCameraMask))
1170   {
1171      bstream->write(mAngularForce);
1172      bstream->write(mAngularDrag);
1173      bstream->write(mMass);
1174      bstream->write(mDrag);
1175      bstream->write(mFlyForce);
1176      bstream->write(mSpeedMultiplier);
1177      bstream->write(mBrakeMultiplier);
1178   }
1179
1180   if(bstream->writeFlag(mask & EditOrbitMask))
1181   {
1182      bstream->write(mEditOrbitPoint.x);
1183      bstream->write(mEditOrbitPoint.y);
1184      bstream->write(mEditOrbitPoint.z);
1185      bstream->write(mCurrentEditOrbitDist);
1186   }
1187
1188   // The rest of the data is part of the control object packet update.
1189   // If we're controlled by this client, we don't need to send it.
1190   if(bstream->writeFlag(getControllingClient() == con && !(mask & InitialUpdateMask)))
1191      return 0;
1192
1193   if (bstream->writeFlag(mask & MoveMask))
1194   {
1195      Point3F pos;
1196      mObjToWorld.getColumn(3,&pos);
1197      bstream->write(pos.x);
1198      bstream->write(pos.y);
1199      bstream->write(pos.z);
1200      bstream->write(mRot.x);
1201      bstream->write(mRot.z);
1202
1203      // Only required if in NewtonFlyMode
1204      F32 len = mVelocity.len();
1205      if(bstream->writeFlag(mNewtonMode && len > 0.02f))
1206      {
1207         Point3F outVel = mVelocity;
1208         outVel *= 1.0f/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1afed088663f8704004425cdae2120b9b3">len</a>;
1209         bstream->writeNormalVector(outVel, 10);
1210         len *= 32.0f;  // 5 bits of fraction
1211         if(len > 8191)
1212            len = 8191;
1213         bstream->writeInt((S32)len, 13);
1214      }
1215
1216      // Rotation
1217      len = mAngularVelocity.len();
1218      if(bstream->writeFlag(mNewtonRotation && len > 0.02f))
1219      {
1220         Point3F outVel = mAngularVelocity;
1221         outVel *= 1.0f/<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1afed088663f8704004425cdae2120b9b3">len</a>;
1222         bstream->writeNormalVector(outVel, 10);
1223         len *= 32.0f;  // 5 bits of fraction
1224         if(len > 8191)
1225            len = 8191;
1226         bstream->writeInt((S32)len, 13);
1227      }
1228   }
1229
1230   return 0;
1231}
1232
1233//----------------------------------------------------------------------------
1234
1235void Camera::unpackUpdate(NetConnection *con, BitStream *bstream)
1236{
1237   Parent::unpackUpdate(con,bstream);
1238
1239   if (bstream->readFlag())
1240   {
1241      mLocked = bstream->readFlag();
1242      mathRead(*bstream, &mOffset);
1243   }
1244
1245   // NewtonCameraMask
1246   if(bstream->readFlag())
1247   {
1248      bstream->read(&mAngularForce);
1249      bstream->read(&mAngularDrag);
1250      bstream->read(&mMass);
1251      bstream->read(&mDrag);
1252      bstream->read(&mFlyForce);
1253      bstream->read(&mSpeedMultiplier);
1254      bstream->read(&mBrakeMultiplier);
1255   }
1256
1257   // EditOrbitMask
1258   if(bstream->readFlag())
1259   {
1260      bstream->read(&mEditOrbitPoint.x);
1261      bstream->read(&mEditOrbitPoint.y);
1262      bstream->read(&mEditOrbitPoint.z);
1263      bstream->read(&mCurrentEditOrbitDist);
1264   }
1265
1266   // controlled by the client?
1267   if(bstream->readFlag())
1268      return;
1269
1270   // MoveMask
1271   if (bstream->readFlag())
1272   {
1273      Point3F pos,rot;
1274      bstream->read(&pos.x);
1275      bstream->read(&pos.y);
1276      bstream->read(&pos.z);
1277      bstream->read(&rot.x);
1278      bstream->read(&rot.z);
1279      rot.y = 0.0f;
1280      _setPosition(pos,rot);
1281
1282      // NewtonMode
1283      if(bstream->readFlag())
1284      {
1285         bstream->readNormalVector(&mVelocity, 10);
1286         mVelocity *= bstream->readInt(13) / 32.0f;
1287      }
1288
1289      // NewtonRotation
1290      mNewtonRotation = bstream->readFlag();
1291      if(mNewtonRotation)
1292      {
1293         bstream->readNormalVector(&mAngularVelocity, 10);
1294         mAngularVelocity *= bstream->readInt(13) / 32.0f;
1295      }
1296
1297      if(mMode != OrbitObjectMode)
1298      {
1299         // New delta for client side interpolation
1300         mDelta.pos = pos;
1301         mDelta.rot = rot;
1302         mDelta.posVec = mDelta.rotVec = VectorF(0.0f, 0.0f, 0.0f);
1303      }
1304   }
1305}
1306
1307//----------------------------------------------------------------------------
1308
1309void Camera::initPersistFields()
1310{
1311   addGroup( "Camera" );
1312      addProtectedField( "controlMode", TYPEID< CameraMotionMode >(), Offset( mMode, Camera ),
1313         &_setModeField, &defaultProtectedGetFn,
1314         "The current camera control mode." );
1315   endGroup( "Camera" );
1316
1317   addGroup( "Camera: Newton Mode" );
1318      addField( "newtonMode",               TypeBool,   Offset(mNewtonMode, Camera),
1319         "Apply smoothing (acceleration and damping) to camera movements." );
1320      addField( "newtonRotation",           TypeBool,   Offset(mNewtonRotation, Camera),
1321         "Apply smoothing (acceleration and damping) to camera rotations." );
1322      addProtectedField( "mass",            TypeF32,    Offset(mMass, Camera),            &_setNewtonField, &defaultProtectedGetFn,
1323         "The camera's mass (Newton mode only).  Default value is 10." );
1324      addProtectedField( "drag",            TypeF32,    Offset(mDrag, Camera),            &_setNewtonField, &defaultProtectedGetFn,
1325         "Drag on camera when moving (Newton mode only).  Default value is 2." );
1326      addProtectedField( "force",           TypeF32,    Offset(mFlyForce, Camera),        &_setNewtonField, &defaultProtectedGetFn,
1327         "Force applied on camera when asked to move (Newton mode only).  Default value is 500." );
1328      addProtectedField( "angularDrag",     TypeF32,    Offset(mAngularDrag, Camera),     &_setNewtonField, &defaultProtectedGetFn,
1329         "Drag on camera when rotating (Newton mode only).  Default value is 2." );
1330      addProtectedField( "angularForce",    TypeF32,    Offset(mAngularForce, Camera),    &_setNewtonField, &defaultProtectedGetFn,
1331         "Force applied on camera when asked to rotate (Newton mode only).  Default value is 100." );
1332      addProtectedField( "speedMultiplier", TypeF32,    Offset(mSpeedMultiplier, Camera), &_setNewtonField, &defaultProtectedGetFn,
1333         "Speed multiplier when triggering the accelerator (Newton mode only).  Default value is 2." );
1334      addProtectedField( "brakeMultiplier", TypeF32,    Offset(mBrakeMultiplier, Camera), &_setNewtonField, &defaultProtectedGetFn,
1335         "Speed multiplier when triggering the brake (Newton mode only).  Default value is 2." );
1336   endGroup( "Camera: Newton Mode" );
1337
1338   Parent::initPersistFields();
1339}
1340
1341//-----------------------------------------------------------------------------
1342
1343void Camera::consoleInit()
1344{
1345   Con::addVariable("$Camera::movementSpeed", TypeF32, &smMovementSpeed,
1346      "@brief Global camera movement speed in units/s (typically m/s), with a base value of 40.\n\n"
1347      "Used in the following camera modes:\n"
1348      "- Edit Orbit Mode\n"
1349      "- Fly Mode\n"
1350      "- Overhead Mode\n"
1351      "@ingroup BaseCamera\n");
1352
1353   // ExtendedMove support
1354   Con::addVariable("$camera::extendedMovePosRotIndex", TypeS32, &smExtendedMovePosRotIndex, 
1355      "@brief The ExtendedMove position/rotation index used for camera movements.\n\n"
1356      "@ingroup BaseCamera\n");
1357}
1358
1359//-----------------------------------------------------------------------------
1360
1361bool Camera::_setNewtonField( void *object, const char *index, const char *data )
1362{
1363   static_cast<Camera*>(object)->setMaskBits(NewtonCameraMask);
1364   return true;  // ok to set value
1365}
1366
1367//-----------------------------------------------------------------------------
1368
1369bool Camera::_setModeField( void *object, const char *index, const char *data )
1370{
1371   Camera *cam = static_cast<Camera*>( object );
1372
1373   if( dStricmp(data, "Fly") == 0 )
1374   {
1375      cam->setFlyMode();
1376      return false; // already changed mode
1377   }
1378
1379   else if( dStricmp(data, "EditOrbit" ) == 0 )
1380   {
1381      cam->setEditOrbitMode();
1382      return false; // already changed mode
1383   }
1384
1385   else if( (dStricmp(data, "OrbitObject") == 0 && cam->mMode != OrbitObjectMode) ||
1386            (dStricmp(data, "TrackObject") == 0 && cam->mMode != TrackObjectMode) ||
1387            (dStricmp(data, "OrbitPoint")  == 0 && cam->mMode != OrbitPointMode)  )
1388   {
1389      Con::warnf("Couldn't change Camera mode to %s: required information missing.  Use camera.set%s().", data, data);
1390      return false; // don't change the mode - not valid
1391   }
1392
1393   else if( dStricmp(data, "OrbitObject") != 0 &&
1394            dStricmp(data, "TrackObject") != 0 &&
1395            bool(cam->mOrbitObject) )
1396   {
1397      cam->clearProcessAfter();
1398      cam->clearNotify(cam->mOrbitObject);
1399      cam->mOrbitObject = NULL;
1400   }
1401
1402   // make sure the requested mode is supported, and set it
1403   // NOTE: The _CameraMode namespace is generated by ImplementEnumType above
1404   
1405   const EngineEnumTable& enums = *( TYPE< CameraMotionMode >()->getEnumTable() );
1406   const U32 numValues = enums.getNumValues();
1407   
1408   for( S32 i = 0; i < numValues; ++i)
1409   {
1410      if( dStricmp(data, enums[i].mName) == 0 )
1411      {
1412         cam->mMode = (CameraMotionMode) enums[i].mInt;
1413         return false;
1414      }
1415   }
1416
1417   Con::warnf("Unsupported camera mode: %s", data);
1418   return false;
1419}
1420
1421//-----------------------------------------------------------------------------
1422
1423Point3F Camera::getPosition()
1424{
1425   static Point3F position;
1426   mObjToWorld.getColumn(3, &position);
1427   return position;
1428}
1429
1430//-----------------------------------------------------------------------------
1431
1432void Camera::setFlyMode()
1433{
1434   mMode = FlyMode;
1435
1436   if (bool(mOrbitObject))
1437   {
1438      clearProcessAfter();
1439      clearNotify(mOrbitObject);
1440   }
1441   mOrbitObject = NULL;
1442}
1443
1444//-----------------------------------------------------------------------------
1445
1446void Camera::setNewtonFlyMode()
1447{
1448   mNewtonMode = true;
1449   setFlyMode();
1450}
1451
1452//-----------------------------------------------------------------------------
1453
1454void Camera::setOrbitMode(GameBase *obj, const Point3F &pos, const Point3F &rot, const Point3F& offset, F32 minDist, F32 maxDist, F32 curDist, bool ownClientObject, bool locked)
1455{
1456   mObservingClientObject = ownClientObject;
1457
1458   if (bool(mOrbitObject))
1459   {
1460      clearProcessAfter();
1461      clearNotify(mOrbitObject);
1462   }
1463
1464   mOrbitObject = obj;
1465   if(bool(mOrbitObject))
1466   {
1467      processAfter(mOrbitObject);
1468      deleteNotify(mOrbitObject);
1469      mOrbitObject->getWorldBox().getCenter(&mPosition);
1470      mMode = OrbitObjectMode;
1471   }
1472   else
1473   {
1474      mMode = OrbitPointMode;
1475      mPosition = pos;
1476   }
1477
1478   _setPosition(mPosition, rot);
1479
1480   mMinOrbitDist = minDist;
1481   mMaxOrbitDist = maxDist;
1482   mCurOrbitDist = curDist;
1483
1484   if (locked != mLocked || mOffset != offset)
1485   {
1486      mLocked = locked;
1487      mOffset = offset;
1488      setMaskBits(UpdateMask);
1489   }
1490}
1491
1492//-----------------------------------------------------------------------------
1493
1494void Camera::setTrackObject(GameBase *obj, const Point3F &offset)
1495{
1496   if(bool(mOrbitObject))
1497   {
1498      clearProcessAfter();
1499      clearNotify(mOrbitObject);
1500   }
1501   mOrbitObject = obj;
1502   if(bool(mOrbitObject))
1503   {
1504      processAfter(mOrbitObject);
1505      deleteNotify(mOrbitObject);
1506   }
1507
1508   mOffset = offset;
1509   mMode = TrackObjectMode;
1510
1511   setMaskBits( UpdateMask );
1512}
1513
1514//-----------------------------------------------------------------------------
1515
1516void Camera::_validateEyePoint(F32 pos, MatrixF *mat)
1517{
1518   if (pos != 0) 
1519   {
1520      // Use the eye transform to orient the camera
1521      Point3F dir;
1522      mat->getColumn(1, &dir);
1523      if (mMaxOrbitDist - mMinOrbitDist > 0.0f)
1524         pos *= mMaxOrbitDist - mMinOrbitDist;
1525      
1526      // Use the camera node's pos.
1527      Point3F startPos = getRenderPosition();
1528      Point3F endPos;
1529
1530      // Make sure we don't extend the camera into anything solid
1531      if(mOrbitObject)
1532         mOrbitObject->disableCollision();
1533      disableCollision();
1534      RayInfo collision;
1535      U32 mask = TerrainObjectType |
1536                 WaterObjectType |
1537                 StaticShapeObjectType |
1538                 PlayerObjectType |
1539                 ItemObjectType |
1540                 VehicleObjectType;
1541
1542      SceneContainer* pContainer = isServerObject() ? &gServerContainer : &gClientContainer;
1543      if (!pContainer->castRay(startPos, startPos - dir * 2.5 * pos, mask, &collision))
1544         endPos = startPos - dir * pos;
1545      else
1546      {
1547         float dot = mDot(dir, collision.normal);
1548         if (dot > 0.01f)
1549         {
1550            F32 colDist = mDot(startPos - collision.point, dir) - (1 / dot) * CameraRadius;
1551            if (colDist > pos)
1552               colDist = pos;
1553            if (colDist < 0.0f)
1554               colDist = 0.0f;
1555            endPos = startPos - dir * colDist;
1556         }
1557         else
1558            endPos = startPos - dir * pos;
1559      }
1560      mat->setColumn(3, endPos);
1561      enableCollision();
1562      if(mOrbitObject)
1563         mOrbitObject->enableCollision();
1564   }
1565}
1566
1567//-----------------------------------------------------------------------------
1568
1569void Camera::setTransform(const MatrixF& mat)
1570{
1571   // This method should never be called on the client.
1572
1573   // This currently converts all rotation in the mat into
1574   // rotations around the z and x axis.
1575   Point3F pos,vec;
1576   mat.getColumn(1, &vec);
1577   mat.getColumn(3, &pos);
1578   Point3F rot(-mAtan2(vec.z, mSqrt(vec.x * vec.x + vec.y * vec.y)), 0.0f, -mAtan2(-vec.x, vec.y));
1579   _setPosition(pos,rot);
1580}
1581
1582//-----------------------------------------------------------------------------
1583
1584void Camera::setRenderTransform(const MatrixF& mat)
1585{
1586   // This method should never be called on the client.
1587
1588   // This currently converts all rotation in the mat into
1589   // rotations around the z and x axis.
1590   Point3F pos,vec;
1591   mat.getColumn(1,&vec);
1592   mat.getColumn(3,&pos);
1593   Point3F rot(-mAtan2(vec.z, mSqrt(vec.x*vec.x + vec.y*vec.y)),0,-mAtan2(-vec.x,vec.y));
1594   _setRenderPosition(pos,rot);
1595}
1596
1597//-----------------------------------------------------------------------------
1598
1599F32 Camera::getDamageFlash() const
1600{
1601   if (mMode == OrbitObjectMode && isServerObject() && bool(mOrbitObject))
1602   {
1603      const GameBase *castObj = mOrbitObject;
1604      const ShapeBase* psb = dynamic_cast<const ShapeBase*>(castObj);
1605      if (psb)
1606         return psb->getDamageFlash();
1607   }
1608
1609   return mDamageFlash;
1610}
1611
1612//-----------------------------------------------------------------------------
1613
1614F32 Camera::getWhiteOut() const
1615{
1616   if (mMode == OrbitObjectMode && isServerObject() && bool(mOrbitObject))
1617   {
1618      const GameBase *castObj = mOrbitObject;
1619      const ShapeBase* psb = dynamic_cast<const ShapeBase*>(castObj);
1620      if (psb)
1621         return psb->getWhiteOut();
1622   }
1623
1624   return mWhiteOut;
1625}
1626
1627//-----------------------------------------------------------------------------
1628
1629void Camera::setVelocity(const VectorF& vel)
1630{
1631   mVelocity = vel;
1632   setMaskBits(MoveMask);
1633}
1634
1635//-----------------------------------------------------------------------------
1636
1637void Camera::setAngularVelocity(const VectorF& vel)
1638{
1639   mAngularVelocity = vel;
1640   setMaskBits(MoveMask);
1641}
1642
1643//-----------------------------------------------------------------------------
1644
1645void Camera::setEditOrbitMode()
1646{
1647   mMode = EditOrbitMode;
1648
1649   if (bool(mOrbitObject))
1650   {
1651      clearProcessAfter();
1652      clearNotify(mOrbitObject);
1653   }
1654   mOrbitObject = NULL;
1655
1656   // If there is a valid orbit point, then point to it
1657   // rather than move the camera.
1658   if(mValidEditOrbitPoint)
1659   {
1660      Point3F currentPos;
1661      mObjToWorld.getColumn(3,&currentPos);
1662
1663      Point3F dir = mEditOrbitPoint - currentPos;
1664      mCurrentEditOrbitDist = dir.len();
1665      dir.normalize();
1666
1667      F32 yaw, pitch;
1668      MathUtils::getAnglesFromVector(dir, yaw, pitch);
1669      mRot.x = -pitch;
1670      mRot.z = yaw;
1671   }
1672}
1673
1674//-----------------------------------------------------------------------------
1675
1676void Camera::_calcOrbitPoint( MatrixF* mat, const Point3F& rot )
1677{
1678   Point3F pos;
1679
1680   pos.x = mCurOrbitDist * mSin( rot.x + mDegToRad( 90.0f ) ) * mCos( -1.0f * ( rot.z + mDegToRad( 90.0f ) ) ) + mPosition.x + mOffset.x;
1681   pos.y = mCurOrbitDist * mSin( rot.x + mDegToRad( 90.0f ) ) * mSin( -1.0f * ( rot.z + mDegToRad( 90.0f ) ) ) + mPosition.y + mOffset.y;
1682   pos.z = mCurOrbitDist * mSin( rot.x ) + mPosition.z + mOffset.z;
1683
1684   mat->setColumn( 3, pos );
1685}
1686
1687//-----------------------------------------------------------------------------
1688
1689void Camera::_calcEditOrbitPoint( MatrixF *mat, const Point3F& rot )
1690{
1691   //Point3F dir;
1692   //mat->getColumn(1, &dir);
1693
1694   //Point3F startPos = getRenderPosition();
1695   //Point3F endPos = startPos - dir * mCurrentEditOrbitDist;
1696
1697   Point3F pos;
1698   pos.x = mCurrentEditOrbitDist * mSin(rot.x + mDegToRad(90.0f)) * mCos(-1.0f * (rot.z + mDegToRad(90.0f))) + mEditOrbitPoint.x;
1699   pos.y = mCurrentEditOrbitDist * mSin(rot.x + mDegToRad(90.0f)) * mSin(-1.0f * (rot.z + mDegToRad(90.0f))) + mEditOrbitPoint.y;
1700   pos.z = mCurrentEditOrbitDist * mSin(rot.x) + mEditOrbitPoint.z;
1701
1702   mat->setColumn(3, pos);
1703}
1704
1705//-----------------------------------------------------------------------------
1706
1707void Camera::setValidEditOrbitPoint( bool state )
1708{
1709   mValidEditOrbitPoint = state;
1710   setMaskBits(EditOrbitMask);
1711}
1712
1713//-----------------------------------------------------------------------------
1714
1715Point3F Camera::getEditOrbitPoint() const
1716{
1717   return mEditOrbitPoint;
1718}
1719
1720//-----------------------------------------------------------------------------
1721
1722void Camera::setEditOrbitPoint( const Point3F& pnt )
1723{
1724   // Change the point that we orbit in EditOrbitMode.
1725   // We'll also change the facing and distance of the
1726   // camera so that it doesn't jump around.
1727   Point3F currentPos;
1728   mObjToWorld.getColumn(3,&currentPos);
1729
1730   Point3F dir = pnt - currentPos;
1731   mCurrentEditOrbitDist = dir.len();
1732
1733   if(mMode == EditOrbitMode)
1734   {
1735      dir.normalize();
1736
1737      F32 yaw, pitch;
1738      MathUtils::getAnglesFromVector(dir, yaw, pitch);
1739      mRot.x = -pitch;
1740      mRot.z = yaw;
1741   }
1742
1743   mEditOrbitPoint = pnt;
1744
1745   setMaskBits(EditOrbitMask);
1746}
1747
1748//----------------------------------------------------------------------------
1749
1750void Camera::lookAt( const Point3F& pos )
1751{
1752   Point3F vec;
1753   mObjToWorld.getColumn(3, &mPosition);
1754   vec = pos - mPosition;
1755   vec.normalizeSafe();
1756   F32 pitch, yaw;
1757   MathUtils::getAnglesFromVector(vec, yaw, pitch);
1758   mRot.x = -pitch;
1759   mRot.z = yaw;
1760   _setPosition(mPosition, mRot);
1761}
1762
1763//----------------------------------------------------------------------------
1764
1765void Camera::autoFitRadius( F32 radius )
1766{
1767   F32 fov = mDegToRad( getCameraFov() );
1768   F32 viewradius = (radius * 2.0f) / mTan(fov * 0.5f);
1769
1770   // Be careful of infinite sized objects.  Clip to 16km
1771   if(viewradius > 16000.0f)
1772      viewradius = 16000.0f;
1773
1774   if(mMode == EditOrbitMode && mValidEditOrbitPoint)
1775   {
1776      mCurrentEditOrbitDist = viewradius;
1777   }
1778   else if(mValidEditOrbitPoint)
1779   {
1780      mCurrentEditOrbitDist = viewradius;
1781
1782      Point3F currentPos;
1783      mObjToWorld.getColumn(3,&currentPos);
1784
1785      Point3F dir = mEditOrbitPoint - currentPos;
1786      dir.normalize();
1787
1788      F32 yaw, pitch;
1789      MathUtils::getAnglesFromVector(dir, yaw, pitch);
1790      mRot.x = -pitch;
1791      mRot.z = yaw;
1792
1793      mPosition = mEditOrbitPoint;
1794      _setPosition(mPosition, mRot);
1795      _calcEditOrbitPoint(&mObjToWorld, mRot);
1796   }
1797}
1798
1799//=============================================================================
1800//    Console API.
1801//=============================================================================
1802// MARK: ---- Console API ----
1803
1804//-----------------------------------------------------------------------------
1805
1806DefineEngineMethod( Camera, getMode, Camera::CameraMotionMode, (), ,
1807                   "Returns the current camera control mode.\n\n"
1808                   "@see CameraMotionMode")
1809{
1810   return object->getMode();
1811}
1812
1813//-----------------------------------------------------------------------------
1814
1815DefineEngineMethod( Camera, getPosition, Point3F, (), ,
1816                   "Get the camera's position in the world.\n\n"
1817                   "@returns The position in the form of \"x y z\".")
1818{
1819   return object->getPosition();
1820}
1821
1822//-----------------------------------------------------------------------------
1823
1824DefineEngineMethod( Camera, getRotation, Point3F, (), ,
1825                   "Get the camera's Euler rotation in radians.\n\n"
1826                   "@returns The rotation in radians in the form of \"x y z\".")
1827{
1828   return object->getRotation();
1829}
1830
1831//-----------------------------------------------------------------------------
1832
1833DefineEngineMethod( Camera, setRotation, void, ( Point3F rot ), ,
1834                   "Set the camera's Euler rotation in radians.\n\n"
1835                   "@param rot The rotation in radians in the form of \"x y z\"."
1836                   "@note Rotation around the Y axis is ignored" )
1837{
1838   return object->setRotation( rot );
1839}
1840
1841//-----------------------------------------------------------------------------
1842
1843DefineEngineMethod( Camera, getOffset, Point3F, (), ,
1844                   "Get the camera's offset from its orbit or tracking point.\n\n"
1845                   "The offset is added to the camera's position when set to CameraMode::OrbitObject.\n"
1846                   "@returns The offset in the form of \"x y z\".")
1847{
1848   return object->getOffset();
1849}
1850
1851//-----------------------------------------------------------------------------
1852
1853DefineEngineMethod( Camera, setOffset, void, (Point3F offset), ,
1854                   "Set the camera's offset.\n\n"
1855                   "The offset is added to the camera's position when set to CameraMode::OrbitObject.\n"
1856                   "@param offset The distance to offset the camera by in the form of \"x y z\".")
1857{
1858   object->setOffset(offset);
1859}
1860
1861//-----------------------------------------------------------------------------
1862
1863DefineEngineMethod( Camera, setOrbitMode, void, (GameBase* orbitObject, TransformF orbitPoint, F32 minDistance, F32 maxDistance, 
1864                    F32 initDistance, bool ownClientObj, Point3F offset, bool locked), (false, Point3F::Zero, false),
1865                    "Set the camera to orbit around the given object, or if none is given, around the given point.\n\n"
1866                    "@param orbitObject The object to orbit around.  If no object is given (0 or blank string is passed in) use the orbitPoint instead\n"
1867                    "@param orbitPoint The point to orbit around when no object is given.  In the form of \"x y z ax ay az aa\" such as returned by SceneObject::getTransform().\n"
1868                    "@param minDistance The minimum distance allowed to the orbit object or point.\n"
1869                    "@param maxDistance The maximum distance allowed from the orbit object or point.\n"
1870                    "@param initDistance The initial distance from the orbit object or point.\n"
1871                    "@param ownClientObj [optional] Are we orbiting an object that is owned by us?  Default is false.\n"
1872                    "@param offset [optional] An offset added to the camera's position.  Default is no offset.\n"
1873                    "@param locked [optional] Indicates the camera does not receive input from the player.  Default is false.\n"
1874                    "@see Camera::setOrbitObject()\n"
1875                    "@see Camera::setOrbitPoint()\n")
1876{
1877   MatrixF mat;
1878   orbitPoint.mOrientation.setMatrix(&mat);
1879   object->setOrbitMode(orbitObject, orbitPoint.mPosition, mat.toEuler(), offset, 
1880      minDistance, maxDistance, initDistance, ownClientObj, locked);
1881}
1882
1883//-----------------------------------------------------------------------------
1884
1885DefineEngineMethod( Camera, setOrbitObject, bool, (GameBase* orbitObject, VectorF rotation, F32 minDistance, 
1886                    F32 maxDistance, F32 initDistance, bool ownClientObject, Point3F offset, bool locked),
1887                    (false, Point3F::Zero, false),
1888                    "Set the camera to orbit around a given object.\n\n"
1889                    "@param orbitObject The object to orbit around.\n"
1890                    "@param rotation The initial camera rotation about the object in radians in the form of \"x y z\".\n"
1891                    "@param minDistance The minimum distance allowed to the orbit object or point.\n"
1892                    "@param maxDistance The maximum distance allowed from the orbit object or point.\n"
1893                    "@param initDistance The initial distance from the orbit object or point.\n"
1894                    "@param ownClientObject [optional] Are we orbiting an object that is owned by us?  Default is false.\n"
1895                    "@param offset [optional] An offset added to the camera's position.  Default is no offset.\n"
1896                    "@param locked [optional] Indicates the camera does not receive input from the player.  Default is false.\n"
1897                    "@returns false if the given object could not be found.\n"
1898                    "@see Camera::setOrbitMode()\n")
1899{
1900   if( !orbitObject )
1901   {
1902      Con::errorf( "Camera::setOrbitObject - Invalid object");
1903      return false;
1904   }
1905
1906   object->setOrbitMode(orbitObject, Point3F(0.0f, 0.0f, 0.0f), rotation, offset, 
1907      minDistance, maxDistance, initDistance, ownClientObject, locked);
1908   return true;
1909}
1910
1911//-----------------------------------------------------------------------------
1912
1913DefineEngineMethod( Camera, setOrbitPoint, void, (TransformF orbitPoint, F32 minDistance, F32 maxDistance, F32 initDistance, 
1914                    Point3F offset, bool locked),
1915                    (Point3F::Zero, false),
1916                    "Set the camera to orbit around a given point.\n\n"
1917                    "@param orbitPoint The point to orbit around.  In the form of \"x y z ax ay az aa\" such as returned by SceneObject::getTransform().\n"
1918                    "@param minDistance The minimum distance allowed to the orbit object or point.\n"
1919                    "@param maxDistance The maximum distance allowed from the orbit object or point.\n"
1920                    "@param initDistance The initial distance from the orbit object or point.\n"
1921                    "@param offset [optional] An offset added to the camera's position.  Default is no offset.\n"
1922                    "@param locked [optional] Indicates the camera does not receive input from the player.  Default is false.\n"
1923                    "@see Camera::setOrbitMode()\n")
1924{
1925   MatrixF mat;
1926   orbitPoint.mOrientation.setMatrix(&mat);
1927   object->setOrbitMode(NULL, orbitPoint.mPosition, mat.toEuler(), offset, 
1928      minDistance, maxDistance, initDistance, false, locked);
1929}
1930
1931//-----------------------------------------------------------------------------
1932
1933DefineEngineMethod( Camera, setTrackObject, bool, (GameBase* trackObject, Point3F offset), (Point3F::Zero),
1934                    "Set the camera to track a given object.\n\n"
1935                    "@param trackObject The object to track.\n"
1936                    "@param offset [optional] An offset added to the camera's position.  Default is no offset.\n"
1937                    "@returns false if the given object could not be found.\n")
1938{
1939   if(!trackObject)
1940   {
1941      Con::warnf("Cannot track non-existing object.");
1942      return false;
1943   }
1944
1945   object->setTrackObject(trackObject, offset);
1946   return true;
1947}
1948
1949//-----------------------------------------------------------------------------
1950
1951DefineEngineMethod( Camera, setEditOrbitMode, void, (), ,
1952                    "Set the editor camera to orbit around a point set with Camera::setEditOrbitPoint().\n\n"
1953                    "@note This method is generally used only within the World Editor and other tools.  To "
1954                    "orbit about an object or point within a game, see Camera::setOrbitMode() and its helper methods.\n")
1955{
1956   object->setEditOrbitMode();
1957}
1958
1959//-----------------------------------------------------------------------------
1960
1961DefineEngineMethod( Camera, setFlyMode, void, (), ,
1962                   "Set the camera to fly freely.\n\n"
1963                   "Allows the camera to have 6 degrees of freedom.  Provides for instantaneous motion "
1964                   "and rotation unless one of the Newton fields has been set to true.  See Camera::newtonMode "
1965                   "and Camera::newtonRotation.\n")
1966{
1967   object->setFlyMode();
1968}
1969
1970//-----------------------------------------------------------------------------
1971
1972DefineEngineMethod( Camera, setNewtonFlyMode, void, (), ,
1973                    "Set the camera to fly freely, but with ease-in and ease-out.\n\n"
1974                    "This method allows for the same 6 degrees of freedom as Camera::setFlyMode() but "
1975                    "activates the ease-in and ease-out on the camera's movement.  To also activate "
1976                    "Newton mode for the camera's rotation, set Camera::newtonRotation to true.")
1977{
1978   object->setNewtonFlyMode();
1979}
1980
1981//-----------------------------------------------------------------------------
1982
1983DefineEngineMethod( Camera, isRotationDamped, bool, (), ,
1984                    "Is this a Newton Fly mode camera with damped rotation?\n\n"
1985                    "@returns true if the camera uses a damped rotation.  i.e. Camera::newtonRotation is set to true.\n")
1986{
1987   return object->isRotationDamped();
1988}
1989
1990//-----------------------------------------------------------------------------
1991
1992DefineEngineMethod( Camera, getAngularVelocity, VectorF, (), ,
1993                   "Get the angular velocity for a Newton mode camera.\n\n"
1994                   "@returns The angular velocity in the form of \"x y z\".\n"
1995                   "@note Only returns useful results when Camera::newtonRotation is set to true.")
1996{
1997   return object->getAngularVelocity();
1998}
1999
2000//-----------------------------------------------------------------------------
2001
2002DefineEngineMethod( Camera, setAngularVelocity, void, (VectorF velocity), ,
2003                   "Set the angular velocity for a Newton mode camera.\n\n"
2004                   "@param velocity The angular velocity infor form of \"x y z\".\n"
2005                   "@note Only takes affect when Camera::newtonRotation is set to true.")
2006{
2007   object->setAngularVelocity(velocity);
2008}
2009
2010//-----------------------------------------------------------------------------
2011
2012DefineEngineMethod( Camera, setAngularForce, void, (F32 force), ,
2013                   "Set the angular force for a Newton mode camera.\n\n"
2014                   "@param force The angular force applied when attempting to rotate the camera."
2015                   "@note Only takes affect when Camera::newtonRotation is set to true.")
2016{
2017   object->setAngularForce(force);
2018}
2019
2020//-----------------------------------------------------------------------------
2021
2022DefineEngineMethod( Camera, setAngularDrag, void, (F32 drag), ,
2023                   "Set the angular drag for a Newton mode camera.\n\n"
2024                   "@param drag The angular drag applied while the camera is rotating."
2025                   "@note Only takes affect when Camera::newtonRotation is set to true.")
2026{
2027   object->setAngularDrag(drag);
2028}
2029
2030//-----------------------------------------------------------------------------
2031
2032DefineEngineMethod( Camera, setMass, void, (F32 mass), ,
2033                   "Set the mass for a Newton mode camera.\n\n"
2034                   "@param mass The mass used during ease-in and ease-out calculations."
2035                   "@note Only used when Camera is in Newton mode.")
2036{
2037   object->setMass(mass);
2038}
2039
2040//-----------------------------------------------------------------------------
2041
2042DefineEngineMethod( Camera, getVelocity, VectorF, (), ,
2043                   "Get the velocity for the camera.\n\n"
2044                   "@returns The camera's velocity in the form of \"x y z\"."
2045                   "@note Only useful when the Camera is in Newton mode.")
2046{
2047   return object->getVelocity();
2048}
2049
2050//-----------------------------------------------------------------------------
2051
2052DefineEngineMethod( Camera, setVelocity, void, (VectorF velocity), ,
2053                   "Set the velocity for the camera.\n\n"
2054                   "@param velocity The camera's velocity in the form of \"x y z\"."
2055                   "@note Only affects the Camera when in Newton mode.")
2056{
2057   object->setVelocity(velocity);
2058}
2059
2060//-----------------------------------------------------------------------------
2061
2062DefineEngineMethod( Camera, setDrag, void, (F32 drag), ,
2063                   "Set the drag for a Newton mode camera.\n\n"
2064                   "@param drag The drag applied to the camera while moving."
2065                   "@note Only used when Camera is in Newton mode.")
2066{
2067   object->setDrag(drag);
2068}
2069
2070//-----------------------------------------------------------------------------
2071
2072DefineEngineMethod( Camera, setFlyForce, void, (F32 force), ,
2073                   "Set the force applied to a Newton mode camera while moving.\n\n"
2074                   "@param force The force applied to the camera while attempting to move."
2075                   "@note Only used when Camera is in Newton mode.")
2076{
2077   object->setFlyForce(force);
2078}
2079
2080//-----------------------------------------------------------------------------
2081
2082DefineEngineMethod( Camera, setSpeedMultiplier, void, (F32 multiplier), ,
2083                   "Set the Newton mode camera speed multiplier when trigger[0] is active.\n\n"
2084                   "@param multiplier The speed multiplier to apply."
2085                   "@note Only used when Camera is in Newton mode.")
2086{
2087   object->setSpeedMultiplier(multiplier);
2088}
2089
2090//-----------------------------------------------------------------------------
2091
2092DefineEngineMethod( Camera, setBrakeMultiplier, void, (F32 multiplier), ,
2093                   "Set the Newton mode camera brake multiplier when trigger[1] is active.\n\n"
2094                   "@param multiplier The brake multiplier to apply."
2095                   "@note Only used when Camera is in Newton mode.")
2096{
2097   object->setBrakeMultiplier(multiplier);
2098}
2099
2100//----------------------------------------------------------------------------
2101
2102DefineEngineMethod( Camera, isEditOrbitMode, bool, (), ,
2103                   "Is the camera in edit orbit mode?\n\n"
2104                   "@returns true if the camera is in edit orbit mode.")
2105{
2106   return object->isEditOrbitMode();
2107}
2108
2109//----------------------------------------------------------------------------
2110
2111DefineEngineMethod( Camera, setValidEditOrbitPoint, void, (bool validPoint), ,
2112                   "Set if there is a valid editor camera orbit point.\n"
2113                   "When validPoint is set to false the Camera operates as if it is "
2114                   "in Fly mode rather than an Orbit mode.\n\n"
2115                   "@param validPoint Indicates the validity of the orbit point."
2116                   "@note Only used when Camera is in Edit Orbit Mode.")
2117{
2118   object->setValidEditOrbitPoint(validPoint);
2119}
2120
2121//----------------------------------------------------------------------------
2122
2123DefineEngineMethod( Camera, setEditOrbitPoint, void, (Point3F point), ,
2124                   "Set the editor camera's orbit point.\n\n"
2125                   "@param point The point the camera will orbit in the form of \"x y z\".")
2126{
2127   object->setEditOrbitPoint(point);
2128}
2129
2130//----------------------------------------------------------------------------
2131
2132DefineEngineMethod( Camera, autoFitRadius, void, (F32 radius), ,
2133                   "Move the camera to fully view the given radius.\n\n"
2134                   "@note For this operation to take affect a valid edit orbit point must first be specified.  See Camera::setEditOrbitPoint().\n"
2135                   "@param radius The radius to view.")
2136{
2137   object->autoFitRadius(radius);
2138}
2139
2140//----------------------------------------------------------------------------
2141
2142DefineEngineMethod( Camera, lookAt, void, (Point3F point), ,
2143                   "Point the camera at the specified position.  Does not work in Orbit or Track modes.\n\n"
2144                   "@param point The position to point the camera at.")
2145{
2146   object->lookAt(point);
2147}
2148