Hello,
I’m currently trying to make some tunnelling effect. Really simple, nothing fancy. I thought it would be rather simple, but I find myself unable to perform this… I would appreciate any help, because there is apparently something I’m missing…
Here is my code :
@
kmVec3 vEyes, vLookAt, vUp;
vUp.x = 0, vUp.y = 1.f, vUp.z = 0;
vEyes.x = 0, vEyes.y = 0, vEyes.z = mfCurrentProgress;
vLookAt.x = 0, vLookAt.y = 0, vLookAt.z = mfCurrentProgress + 50;
kmMat4 mPerspective, mView, mGlobal;
kmMat4LookAt( &mView, &vEyes, &vLookAt, &vUp );
kmMat4PerspectiveProjection( &mPerspective, 50.f, FRAME_SIZE.width / FRAME_SIZE.height, 5.f, 5000.f );
kmMat4Multiply( &mGlobal, &mPerspective, &mView );
for( std::list< Section >::const_iterator it = mitCurrentFirstSection;
it != mlevelDef.end(); ++it )
{
kmVec3 vRefPosition;
vRefPosition.x = 0;
vRefPosition.y = 0;
vRefPosition.z = it~~>depth;
kmVec3 vScreenPosition;
kmVec3Transform;
kmVec3 vRefPosition2;
vRefPosition2.x = 0;
vRefPosition2.y = 25;
vRefPosition2.z = it~~>depth();
kmVec3 vScreenPosition2;
kmVec3Transform( &vScreenPosition2, &vRefPosition2, &mGlobal );
// Draw the section
glLineWidth( 2 );
ccDrawColor4B( 180, 12, 12, 255 );
CCPoint pt2DRef( vScreenPosition2.x - vScreenPosition.x, vScreenPosition2.y - vScreenPosition.y );
ccDrawCircle( CCPoint( FRAME_SIZE.width / 2, FRAME_SIZE.height / 2 ), ccpLength( pt2DRef ), 0, 8,
false, 1, 1 );
}
@
mfCurrentProgress increases with time so we should move along the “tube”.
Thanks for any help, guys. And thanks for your time, no matter what