| 62 | } |
| 63 | |
| 64 | void _attachPathObject( VPath *pPath, SceneObject *pObject, const bool &pForward, const bool &pRelative, const S32 &pStartNodeIndex, const S32 &pEndNodeIndex, const String &pOrientation, const String &pOrientationData ) |
| 65 | { |
| 66 | if ( pOrientation == String::EmptyString ) |
| 67 | { |
| 68 | // Attach Object. |
| 69 | pPath->attachObject( pObject, pForward, 0.f, pRelative, pStartNodeIndex, pEndNodeIndex ); |
| 70 | // Quit. |
| 71 | return; |
| 72 | } |
| 73 | |
| 74 | // Fetch Orientation. |
| 75 | const VPathObject::eOrientationType type = VPathObject::getOrientationTypeEnum( pOrientation ); |
| 76 | |
| 77 | switch ( type ) |
| 78 | { |
| 79 | case VPathObject::k_OrientationFree : |
| 80 | case VPathObject::k_OrientationInterpolate : |
| 81 | case VPathObject::k_OrientationToPath : |
| 82 | { |
| 83 | // Attach Object. |
| 84 | pPath->attachObject( pObject, pForward, 0.f, pRelative, pStartNodeIndex, pEndNodeIndex, type, NULL ); |
| 85 | |
| 86 | } break; |
| 87 | |
| 88 | case VPathObject::k_OrientationToObject : |
| 89 | { |
| 90 | // Fetch Object. |
| 91 | SceneObject *lookAtObject = dynamic_cast<SceneObject*>( Sim::findObject( pOrientationData ) ); |
| 92 | // Valid Object? |
| 93 | if ( lookAtObject != NULL ) |
| 94 | { |
| 95 | // Attach Object. |
| 96 | pPath->attachObject( pObject, pForward, 0.f, pRelative, pStartNodeIndex, pEndNodeIndex, type, (void*)lookAtObject ); |
| 97 | } |
| 98 | |
| 99 | } break; |
| 100 | |
| 101 | case VPathObject::k_OrientationToPoint: |
| 102 | { |
| 103 | // Fetch Point. |
| 104 | Point3F lookAtPoint( 0.f, 0.f, 0.f ); |
| 105 | if ( dSscanf( pOrientationData, "%g %g %g", &lookAtPoint.x, &lookAtPoint.y, &lookAtPoint.z ) == 3 ) |
| 106 | { |
| 107 | // Attach Object. |
| 108 | pPath->attachObject( pObject, pForward, 0.f, pRelative, pStartNodeIndex, pEndNodeIndex, type, (void*)lookAtPoint ); |
| 109 | } |
| 110 | |
| 111 | } break; |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | //----------------------------------------------------------------------------- |
| 116 | // |
no test coverage detected