pathShape.cpp
Engine/source/T3D/pathShape.cpp
Public Functions
DefineEngineMethod(PathShape , getState , S32 , () , "PathShape.getState()" )
DefineEngineMethod(PathShape , popFront , void , () , "Removes the knot at the front of the camera's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Remove the first knot in the camera's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "%pathCamera.popFront();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineEngineMethod(PathShape , pushBack , void , (TransformF transform, F32 speed, const char *type, const char *path) , (TransformF::Identity, 1.0f, "Normal", "Linear") , "@brief Adds <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the back of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> path camera's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "@param transform Transform <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot. 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 speed Speed setting <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">knot.\n</a>" "@param type Knot type (Normal, Position Only, Kink).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param path %Path type (Linear, Spline).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Transform vector <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot. (Pos_X Pos_Y Pos_Z Rot_X Rot_Y Rot_Z Angle)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% transform)
DefineEngineMethod(PathShape , pushFront , void , (TransformF transform, F32 speed, const char *type, const char *path) , (1.0f, "Normal", "Linear") , "@brief Adds <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the front of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> path camera's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "@param transform Transform <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot. 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 speed Speed setting <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">knot.\n</a>" "@param type Knot type (Normal, Position Only, Kink).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param path %Path type (Linear, Spline).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Transform vector <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot. (Pos_X,Pos_Y,Pos_Z,Rot_X,Rot_Y,Rot_Z,Angle)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% transform)
DefineEngineMethod(PathShape , reset , void , (F32 speed) , (1.0f) , "@brief Clear the camera's path and set the camera's current transform as the start of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n\n</a>" "What specifically occurs is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot is created from the camera's current transform. Then the current path " "is cleared and the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot is pushed onto the path. Any previous target is cleared and the camera's movement " "state is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> Forward. The camera is now ready <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">defined.\n</a>" "@param speed Speed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move along its path after being <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">reset.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Determine the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> movement speed of this camera. If not set, the speed will default <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 1.0.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% speed)
DefineEngineMethod(PathShape , setPosition , void , (F32 position) , (0.0f) , "Set the current position of the camera along the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "@param position Position along the path, from 0. 0, <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> place the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Set the camera on <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> position along its path from 0.0 - 1.0.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% position)
DefineEngineMethod(PathShape , setState , void , (const char *newState) , ("forward") , "Set the movement state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this path <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n</a>" "@param newState New movement state type <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this camera. Forward, Backward or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Stop.\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Set the state type(forward, backward, stop).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//In this example, the camera will travel from the first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node\n</a>" "//<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the last node(or target <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> given with setTarget())\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% state)
DefineEngineMethod(PathShape , setTarget , void , (F32 position) , (1.0f) , "@brief Set the movement target <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this camera along its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n\n</a>" "The camera will attempt <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move along the path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the given target in the direction provided " "by setState() (the default is forwards). Once the camera moves past this target it will come " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> stop, and the target state will be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">cleared.\n</a>" " @param position Target position, between 0. 0, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> along its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Set the position target, between 0. 0, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "% position)
resolveKnotPath(const char * arg)
resolveKnotType(const char * arg)
Detailed Description
Public Functions
DefineEngineMethod(PathShape , getState , S32 , () , "PathShape.getState()" )
DefineEngineMethod(PathShape , popFront , void , () , "Removes the knot at the front of the camera's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Remove the first knot in the camera's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "%pathCamera.popFront();\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">endtsexample\n</a>" )
DefineEngineMethod(PathShape , pushBack , void , (TransformF transform, F32 speed, const char *type, const char *path) , (TransformF::Identity, 1.0f, "Normal", "Linear") , "@brief Adds <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the back of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> path camera's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "@param transform Transform <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot. 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 speed Speed setting <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">knot.\n</a>" "@param type Knot type (Normal, Position Only, Kink).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param path %Path type (Linear, Spline).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Transform vector <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot. (Pos_X Pos_Y Pos_Z Rot_X Rot_Y Rot_Z Angle)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% transform)
DefineEngineMethod(PathShape , pushFront , void , (TransformF transform, F32 speed, const char *type, const char *path) , (1.0f, "Normal", "Linear") , "@brief Adds <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the front of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> path camera's <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "@param transform Transform <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot. 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 speed Speed setting <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">knot.\n</a>" "@param type Knot type (Normal, Position Only, Kink).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@param path %Path type (Linear, Spline).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "// Transform vector <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot. (Pos_X,Pos_Y,Pos_Z,Rot_X,Rot_Y,Rot_Z,Angle)\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% transform)
DefineEngineMethod(PathShape , reset , void , (F32 speed) , (1.0f) , "@brief Clear the camera's path and set the camera's current transform as the start of the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n\n</a>" "What specifically occurs is <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot is created from the camera's current transform. Then the current path " "is cleared and the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> knot is pushed onto the path. Any previous target is cleared and the camera's movement " "state is set <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> Forward. The camera is now ready <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">defined.\n</a>" "@param speed Speed <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move along its path after being <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">reset.\n</a>" "@<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Determine the <a href="/coding/file/tmm__on_8h/#tmm__on_8h_1a1ac41480eb2e4aadd52252ee550b630a">new</a> movement speed of this camera. If not set, the speed will default <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> 1.0.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% speed)
DefineEngineMethod(PathShape , setPosition , void , (F32 position) , (0.0f) , "Set the current position of the camera along the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" "@param position Position along the path, from 0. 0, <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> place the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Set the camera on <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> position along its path from 0.0 - 1.0.\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% position)
DefineEngineMethod(PathShape , setState , void , (const char *newState) , ("forward") , "Set the movement state <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this path <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">camera.\n</a>" "@param newState New movement state type <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this camera. Forward, Backward or <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">Stop.\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Set the state type(forward, backward, stop).\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "//In this example, the camera will travel from the first <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">node\n</a>" "//<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the last node(or target <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> given with setTarget())\<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">n</a>" "% state)
DefineEngineMethod(PathShape , setTarget , void , (F32 position) , (1.0f) , "@brief Set the movement target <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this camera along its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n\n</a>" "The camera will attempt <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move along the path <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the given target in the direction provided " "by setState() (the default is forwards). Once the camera moves past this target it will come " "<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> stop, and the target state will be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">cleared.\n</a>" " @param position Target position, between 0. 0, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> along its <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">path.\n</a>" " @<a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">tsexample\n</a>" "//Set the position target, between 0. 0, <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> this camera <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> move <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">to.\n</a>" "% position)
IMPLEMENT_CO_DATABLOCK_V1(PathShapeData )
IMPLEMENT_CO_NETOBJECT_V1(PathShape )
resolveKnotPath(const char * arg)
resolveKnotType(const char * arg)
1 2//----------------------------------------------------------------------------- 3// Torque Game Engine 4// Copyright (C) GarageGames.com, Inc. 5// @author Stefan "Beffy" Moises 6// this is a modified version of PathCamera that allows to move shapes along paths 7//----------------------------------------------------------------------------- 8 9#include "platform/platform.h" 10#include "math/mMath.h" 11#include "math/mathIO.h" 12#include "console/simBase.h" 13#include "console/console.h" 14#include "console/consoleTypes.h" 15#include "core/stream/bitStream.h" 16#include "core/dnet.h" 17#include "scene/pathManager.h" 18#include "T3D/gameFunctions.h" 19#include "T3D/gameBase/gameConnection.h" 20#include "gui/worldEditor/editor.h" 21#include "console/engineAPI.h" 22#include "math/mTransform.h" 23 24#include "T3D/pathShape.h" 25 26 27//---------------------------------------------------------------------------- 28 29IMPLEMENT_CO_DATABLOCK_V1(PathShapeData); 30 31void PathShapeData::consoleInit() 32{ 33} 34 35 36bool PathShapeData::preload(bool server, String &errorStr) 37{ 38 39 if(!Parent::preload(server, errorStr)) 40 return false; 41 42 return true; 43} 44 45 46void PathShapeData::initPersistFields() 47{ 48 Parent::initPersistFields(); 49} 50 51void PathShapeData::packData(BitStream* stream) 52{ 53 Parent::packData(stream); 54} 55 56void PathShapeData::unpackData(BitStream* stream) 57{ 58 Parent::unpackData(stream); 59} 60 61 62//---------------------------------------------------------------------------- 63 64IMPLEMENT_CO_NETOBJECT_V1(PathShape); 65 66PathShape::PathShape() 67{ 68 mNetFlags.set(Ghostable</a>|<a href="/coding/class/classnetobject/#classnetobject_1ab7f7b94af4c238c69f5673a98199a01caa501b2b8ffe184a0a58342a1b9790258">ScopeAlways); 69 mTypeMask |= PathShapeObjectType | StaticShapeObjectType; 70 delta.time = 0; 71 delta.timeVec = 0; 72 mDataBlock = NULL; 73 mState = Forward; 74 mNodeBase = 0; 75 mNodeCount = 0; 76 mPosition = 0; 77 mTarget = 0; 78 mTargetSet = false; 79 80 MatrixF mat(1); 81 mat.setPosition(Point3F(0,0,700)); 82 Parent::setTransform(mat); 83 84 mLastXform = mat; 85 for (U32 i = 0; i < 4; i++) 86 { 87 mControl[i] = StringTable->insert(""); 88 } 89} 90 91PathShape::~PathShape() 92{ 93} 94 95 96//---------------------------------------------------------------------------- 97 98bool PathShape::onAdd() 99{ 100 if(!Parent::onAdd() && !mDataBlock) 101 return false; 102 103 mTypeMask |= PathShapeObjectType | StaticShapeObjectType; 104 // Initialize from the current transform. 105 if (!mNodeCount) { 106 QuatF rot(getTransform()); 107 Point3F pos = getPosition(); 108 mSpline.removeAll(); 109 mSpline.push_back(new CameraSpline::Knot(pos,rot,1, 110 CameraSpline::Knot::NORMAL, CameraSpline::Knot::SPLINE)); 111 mNodeCount = 1; 112 } 113 114 if (isServerObject()) scriptOnAdd(); 115 return true; 116 117} 118 119void PathShape::onRemove() 120{ 121 scriptOnRemove(); 122 removeFromScene(); 123 124 unmount(); 125 Parent::onRemove(); 126 127 if (isGhost()) 128 for (S32 i = 0; i < MaxSoundThreads; i++) 129 stopAudio(i); 130} 131 132bool PathShape::onNewDataBlock(GameBaseData* dptr, bool reload) 133{ 134 mDataBlock = dynamic_cast<PathShapeData*>(dptr); 135 if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) 136 return false; 137 138 scriptOnNewDataBlock(); 139 return true; 140} 141 142PathShapeData::PathShapeData() 143{ 144 145} 146 147//---------------------------------------------------------------------------- 148 149void PathShape::initPersistFields() 150{ 151 152 addField( "Path", TYPEID< SimObjectRef<SimPath::Path> >(), Offset( mSimPath, PathShape ), 153 "@brief Name of a Path to follow." ); 154 155 addField("Controler", TypeString, Offset(mControl, PathShape), 4, "controlers"); 156 157 Parent::initPersistFields(); 158 159} 160 161void PathShape::consoleInit() 162{ 163} 164 165 166//---------------------------------------------------------------------------- 167 168void PathShape::processTick(const Move* move) 169{ 170 // client and server 171 Parent::processTick(move); 172 173 // Move to new time 174 advancePosition(TickMs); 175 176 MatrixF mat; 177 interpolateMat(mPosition,&mat); 178 Parent::setTransform(mat); 179 180 updateContainer(); 181} 182 183void PathShape::interpolateTick(F32 dt) 184{ 185 Parent::interpolateTick(dt); 186 MatrixF mat; 187 interpolateMat(delta.time + (delta.timeVec * dt),&mat); 188 Parent::setRenderTransform(mat); 189} 190 191void PathShape::interpolateMat(F32 pos,MatrixF* mat) 192{ 193 CameraSpline::Knot knot; 194 mSpline.value(pos - mNodeBase,&knot); 195 knot.mRotation.setMatrix(mat); 196 mat->setPosition(knot.mPosition); 197} 198 199void PathShape::advancePosition(S32 ms) 200{ 201 delta.timeVec = mPosition; 202 203 // Advance according to current speed 204 if (mState == Forward) { 205 mPosition = mSpline.advanceTime(mPosition - mNodeBase,ms); 206 if (mPosition > F32(mNodeCount - 1)) 207 mPosition = F32(mNodeCount - 1); 208 mPosition += (F32)mNodeBase; 209 if (mTargetSet && mPosition >= mTarget) { 210 mTargetSet = false; 211 mPosition = mTarget; 212 mState = Stop; 213 } 214 } 215 else 216 if (mState == Backward) { 217 mPosition = mSpline.advanceTime(mPosition - mNodeBase,-ms); 218 if (mPosition < 0) 219 mPosition = 0; 220 mPosition += mNodeBase; 221 if (mTargetSet && mPosition <= mTarget) { 222 mTargetSet = false; 223 mPosition = mTarget; 224 mState = Stop; 225 } 226 } 227 228 // Script callbacks 229 if (int(mPosition) != int(delta.timeVec)) 230 onNode(int(mPosition)); 231 232 // Set frame interpolation 233 delta.time = mPosition; 234 delta.timeVec -= mPosition; 235} 236 237 238//---------------------------------------------------------------------------- 239 240 241void PathShape::setPosition(F32 pos) 242{ 243 mPosition = mClampF(pos,mNodeBase,mNodeBase + mNodeCount - 1); 244 MatrixF mat; 245 interpolateMat(mPosition,&mat); 246 Parent::setTransform(mat); 247 setMaskBits(PositionMask); 248} 249 250void PathShape::setTarget(F32 pos) 251{ 252 mTarget = pos; 253 mTargetSet = true; 254 if (mTarget > mPosition) 255 mState = Forward; 256 else 257 if (mTarget < mPosition) 258 mState = Backward; 259 else { 260 mTargetSet = false; 261 mState = Stop; 262 } 263 setMaskBits(TargetMask | StateMask); 264} 265 266void PathShape::setState(State s) 267{ 268 mState = s; 269 setMaskBits(StateMask); 270} 271 272S32 PathShape::getState() 273{ 274 return mState; 275} 276 277 278//----------------------------------------------------------------------------- 279 280void PathShape::reset(F32 speed) 281{ 282 CameraSpline::Knot *knot = new CameraSpline::Knot; 283 mSpline.value(mPosition - mNodeBase,knot); 284 if (speed) 285 knot->mSpeed = speed; 286 mSpline.removeAll(); 287 mSpline.push_back(knot); 288 289 mNodeBase = 0; 290 mNodeCount = 1; 291 mPosition = 0; 292 mTargetSet = false; 293 mState = Forward; 294 setMaskBits(StateMask | PositionMask | WindowMask | TargetMask); 295} 296 297void PathShape::pushBack(CameraSpline::Knot *knot) 298{ 299 // Make room at the end 300 if (mNodeCount == NodeWindow) { 301 delete mSpline.remove(mSpline.getKnot(0)); 302 mNodeBase++; 303 } 304 else 305 mNodeCount++; 306 307 // Fill in the new node 308 mSpline.push_back(knot); 309 setMaskBits(WindowMask); 310 311 // Make sure the position doesn't fall off 312 if (mPosition < mNodeBase) { 313 mPosition = mNodeBase; 314 setMaskBits(PositionMask); 315 } 316} 317 318void PathShape::pushFront(CameraSpline::Knot *knot) 319{ 320 // Make room at the front 321 if (mNodeCount == NodeWindow) 322 delete mSpline.remove(mSpline.getKnot(mNodeCount)); 323 else 324 mNodeCount++; 325 mNodeBase--; 326 327 // Fill in the new node 328 mSpline.push_front(knot); 329 setMaskBits(WindowMask); 330 331 // Make sure the position doesn't fall off 332 if (mPosition > mNodeBase + (NodeWindow - 1)) { 333 mPosition = mNodeBase + (NodeWindow - 1); 334 setMaskBits(PositionMask); 335 } 336} 337 338void PathShape::popFront() 339{ 340 if (mNodeCount < 2) 341 return; 342 343 // Remove the first node. Node base and position are unaffected. 344 mNodeCount--; 345 delete mSpline.remove(mSpline.getKnot(0)); 346} 347 348 349//---------------------------------------------------------------------------- 350 351void PathShape::onNode(S32 node) 352{ 353 if (!isGhost()) 354 Con::executef(mDataBlock,"onNode",getIdString(), Con::getIntArg(node)); 355} 356 357 358//---------------------------------------------------------------------------- 359 360 361 362//---------------------------------------------------------------------------- 363 364U32 PathShape::packUpdate(NetConnection *con, U32 mask, BitStream *stream) 365{ 366 367 Parent::packUpdate(con,mask,stream); 368 369 if (stream->writeFlag(mask & StateMask)) 370 stream->writeInt(mState,StateBits); 371 372 if (stream->writeFlag(mask & PositionMask)) 373 stream->write(mPosition); 374 375 if (stream->writeFlag(mask & TargetMask)) 376 if (stream->writeFlag(mTargetSet)) 377 stream->write(mTarget); 378 379 if (stream->writeFlag(mask & WindowMask)) { 380 stream->write(mNodeBase); 381 stream->write(mNodeCount); 382 for (S32 i = 0; i < mNodeCount; i++) { 383 CameraSpline::Knot *knot = mSpline.getKnot(i); 384 mathWrite(*stream, knot->mPosition); 385 mathWrite(*stream, knot->mRotation); 386 stream->write(knot->mSpeed); 387 stream->writeInt(knot->mType, CameraSpline::Knot::NUM_TYPE_BITS); 388 stream->writeInt(knot->mPath, CameraSpline::Knot::NUM_PATH_BITS); 389 } 390 } 391 392 // The rest of the data is part of the control object packet update. 393 // If we're controlled by this client, we don't need to send it. 394 if(stream->writeFlag(getControllingClient() == con && !(mask & InitialUpdateMask))) 395 return 0; 396 397 return 0; 398} 399 400void PathShape::unpackUpdate(NetConnection *con, BitStream *stream) 401{ 402 Parent::unpackUpdate(con,stream); 403 404 // StateMask 405 if (stream->readFlag()) 406 mState = stream->readInt(StateBits); 407 408 // PositionMask 409 if (stream->readFlag()) { 410 stream->read(&mPosition); 411 delta.time = mPosition; 412 delta.timeVec = 0; 413 } 414 415 // TargetMask 416 if (stream->readFlag()) { 417 mTargetSet = stream->readFlag(); 418 if (mTargetSet) { 419 stream->read(&mTarget); 420 } 421 } 422 423 // WindowMask 424 if (stream->readFlag()) { 425 mSpline.removeAll(); 426 stream->read(&mNodeBase); 427 stream->read(&mNodeCount); 428 for (S32 i = 0; i < mNodeCount; i++) { 429 CameraSpline::Knot *knot = new CameraSpline::Knot(); 430 mathRead(*stream, &knot->mPosition); 431 mathRead(*stream, &knot->mRotation); 432 stream->read(&knot->mSpeed); 433 knot->mType = (CameraSpline::Knot::Type)stream->readInt(CameraSpline::Knot::NUM_TYPE_BITS); 434 knot->mPath = (CameraSpline::Knot::Path)stream->readInt(CameraSpline::Knot::NUM_PATH_BITS); 435 mSpline.push_back(knot); 436 } 437 } 438 439 // Controlled by the client? 440 if (stream->readFlag()) return; 441} 442 443 444//----------------------------------------------------------------------------- 445// Console access methods 446//----------------------------------------------------------------------------- 447DefineEngineMethod(PathShape, setPosition, void, (F32 position), (0.0f), "Set the current position of the camera along the path.\n" 448 "@param position Position along the path, from 0.0 (path start) - 1.0 (path end), to place the camera.\n" 449 "@tsexample\n" 450 "// Set the camera on a position along its path from 0.0 - 1.0.\n" 451 "%position = \"0.35\";\n\n" 452 "// Force the pathCamera to its new position along the path.\n" 453 "%pathCamera.setPosition(%position);\n" 454 "@endtsexample\n") 455{ 456 object->setPosition(position); 457} 458 459DefineEngineMethod(PathShape, setTarget, void, (F32 position), (1.0f), "@brief Set the movement target for this camera along its path.\n\n" 460 "The camera will attempt to move along the path to the given target in the direction provided " 461 "by setState() (the default is forwards). Once the camera moves past this target it will come " 462 "to a stop, and the target state will be cleared.\n" 463 "@param position Target position, between 0.0 (path start) and 1.0 (path end), for the camera to move to along its path.\n" 464 "@tsexample\n" 465 "// Set the position target, between 0.0 (path start) and 1.0 (path end), for this camera to move to.\n" 466 "%position = \"0.50\";\n\n" 467 "// Inform the pathCamera of the new target position it will move to.\n" 468 "%pathCamera.setTarget(%position);\n" 469 "@endtsexample\n") 470{ 471 object->setTarget(position); 472} 473 474DefineEngineMethod(PathShape, setState, void, (const char* newState), ("forward"), "Set the movement state for this path camera.\n" 475 "@param newState New movement state type for this camera. Forward, Backward or Stop.\n" 476 "@tsexample\n" 477 "// Set the state type (forward, backward, stop).\n" 478 "// In this example, the camera will travel from the first node\n" 479 "// to the last node (or target if given with setTarget())\n" 480 "%state = \"forward\";\n\n" 481 "// Inform the pathCamera to change its movement state to the defined value.\n" 482 "%pathCamera.setState(%state);\n" 483 "@endtsexample\n") 484{ 485 if (!dStricmp(newState, "forward")) 486 object->setState(PathShape::Forward); 487 else 488 if (!dStricmp(newState, "backward")) 489 object->setState(PathShape::Backward); 490 else 491 object->setState(PathShape::Stop); 492} 493 494DefineEngineMethod(PathShape, reset, void, (F32 speed), (1.0f), "@brief Clear the camera's path and set the camera's current transform as the start of the new path.\n\n" 495 "What specifically occurs is a new knot is created from the camera's current transform. Then the current path " 496 "is cleared and the new knot is pushed onto the path. Any previous target is cleared and the camera's movement " 497 "state is set to Forward. The camera is now ready for a new path to be defined.\n" 498 "@param speed Speed for the camera to move along its path after being reset.\n" 499 "@tsexample\n" 500 "//Determine the new movement speed of this camera. If not set, the speed will default to 1.0.\n" 501 "%speed = \"0.50\";\n\n" 502 "// Inform the path camera to start a new path at" 503 "// the camera's current position, and set the new " 504 "// path's speed value.\n" 505 "%pathCamera.reset(%speed);\n" 506 "@endtsexample\n") 507{ 508 object->reset(speed); 509} 510 511static CameraSpline::Knot::Type resolveKnotType(const char *arg) 512{ 513 if (dStricmp(arg, "Position Only") == 0) 514 return CameraSpline::Knot::POSITION_ONLY; 515 if (dStricmp(arg, "Kink") == 0) 516 return CameraSpline::Knot::KINK; 517 return CameraSpline::Knot::NORMAL; 518} 519 520static CameraSpline::Knot::Path resolveKnotPath(const char *arg) 521{ 522 if (!dStricmp(arg, "Linear")) 523 return CameraSpline::Knot::LINEAR; 524 return CameraSpline::Knot::SPLINE; 525} 526 527DefineEngineMethod(PathShape, pushBack, void, (TransformF transform, F32 speed, const char* type, const char* path), 528 (TransformF::Identity, 1.0f, "Normal", "Linear"), 529 "@brief Adds a new knot to the back of a path camera's path.\n" 530 "@param transform Transform for the new knot. In the form of \"x y z ax ay az aa\" such as returned by SceneObject::getTransform()\n" 531 "@param speed Speed setting for this knot.\n" 532 "@param type Knot type (Normal, Position Only, Kink).\n" 533 "@param path %Path type (Linear, Spline).\n" 534 "@tsexample\n" 535 "// Transform vector for new knot. (Pos_X Pos_Y Pos_Z Rot_X Rot_Y Rot_Z Angle)\n" 536 "%transform = \"15.0 5.0 5.0 1.4 1.0 0.2 1.0\"\n\n" 537 "// Speed setting for knot.\n" 538 "%speed = \"1.0\"\n\n" 539 "// Knot type. (Normal, Position Only, Kink)\n" 540 "%type = \"Normal\";\n\n" 541 "// Path Type. (Linear, Spline)\n" 542 "%path = \"Linear\";\n\n" 543 "// Inform the path camera to add a new knot to the back of its path\n" 544 "%pathCamera.pushBack(%transform,%speed,%type,%path);\n" 545 "@endtsexample\n") 546{ 547 QuatF rot(transform.getOrientation()); 548 549 object->pushBack(new CameraSpline::Knot(transform.getPosition(), rot, speed, resolveKnotType(type), resolveKnotPath(path))); 550} 551 552DefineEngineMethod(PathShape, pushFront, void, (TransformF transform, F32 speed, const char* type, const char* path), 553 (1.0f, "Normal", "Linear"), 554 "@brief Adds a new knot to the front of a path camera's path.\n" 555 "@param transform Transform for the new knot. In the form of \"x y z ax ay az aa\" such as returned by SceneObject::getTransform()\n" 556 "@param speed Speed setting for this knot.\n" 557 "@param type Knot type (Normal, Position Only, Kink).\n" 558 "@param path %Path type (Linear, Spline).\n" 559 "@tsexample\n" 560 "// Transform vector for new knot. (Pos_X,Pos_Y,Pos_Z,Rot_X,Rot_Y,Rot_Z,Angle)\n" 561 "%transform = \"15.0 5.0 5.0 1.4 1.0 0.2 1.0\"\n\n" 562 "// Speed setting for knot.\n" 563 "%speed = \"1.0\";\n\n" 564 "// Knot type. (Normal, Position Only, Kink)\n" 565 "%type = \"Normal\";\n\n" 566 "// Path Type. (Linear, Spline)\n" 567 "%path = \"Linear\";\n\n" 568 "// Inform the path camera to add a new knot to the front of its path\n" 569 "%pathCamera.pushFront(%transform, %speed, %type, %path);\n" 570 "@endtsexample\n") 571{ 572 QuatF rot(transform.getOrientation()); 573 574 object->pushFront(new CameraSpline::Knot(transform.getPosition(), rot, speed, resolveKnotType(type), resolveKnotPath(path))); 575} 576 577DefineEngineMethod(PathShape, popFront, void, (), , "Removes the knot at the front of the camera's path.\n" 578 "@tsexample\n" 579 "// Remove the first knot in the camera's path.\n" 580 "%pathCamera.popFront();\n" 581 "@endtsexample\n") 582{ 583 object->popFront(); 584} 585 586DefineEngineMethod(PathShape, getState, S32, (), , "PathShape.getState()") 587{ 588 return object->getState(); 589} 590