In my Smash PC game (detailed in my Old Blog, linked in my Signature), I have a smoke trail for my rocket, and it can shoot at any angle. Although it doesn't follow, it should be the same deal.
Here's the code I use to lay down a smoke (which quickly fades out):
// If we're drawing smoketrails, then lay one down, and set it to fade out
if (mbSmokeTrail)
{
cpVect Loc = mpBody->p;
GameLevel::tLevelItem LevelItem;
LevelItem.ItemName = "Smoke";
// Set location at back of bullet
Loc.x -= cos(mpBody->a)*mpImage->GetWidth()/2;
Loc.y -= sin(mpBody->a)*mpImage->GetHeight()/2;
LevelItem.Location = Loc;
LevelItem.ImageName = ""; // get it from xml
SmashPcItem *pSmokeItem = new SmashPcItem(mGameData,
mpApp, LevelItem, mpSpace);
mGameData.AddActiveItem(pSmokeItem);
}
Basically, I get the center location of the rocket (cpVect Loc = mpBody->p;) Then I take the sin and cos of the angle of the rocket and multiply it by 1/2 the length (which would put it at the end of the rocket), and subtract value from the rocket Location (where mpBody->a is the angle of the rocket in radians and mpImage is the image of the rocket):
Loc.x -= cos(mpBody->a)*mpImage->GetWidth()/2;
Loc.y -= sin(mpBody->a)*mpImage->GetHeight()/2;
Now Loc points to the back of the rocket, regardless the angle it is facing.
Here's an image of the rocket being fired with the smoke trail behind it:
Good Luck!
Edited by BeerNutts, 07 January 2013 - 04:29 PM.