full model rotation for missile models
Moderator: Graf Zahl
-
- Posts: 56
- Joined: Sat Aug 19, 2006 9:47
- Location: Ukraine\Kharkov
full model rotation for missile models
I tried to make model for rocket. i made that, wrote a definition, started the game. all works nice, but when i shoot with a big vertical angle, the missile model is looking the same as it flies dirrect. How to make it rotate vertically, like the sprites are?
-
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
-
- Developer
- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
-
- DRD Team Admin (Inactive)
- Posts: 1058
- Joined: Thu Jun 30, 2005 13:30
- Location: Poland - Grojec / Radom
-
- Stronghold Team
- Posts: 3555
- Joined: Sun Nov 13, 2005 23:15
- Location: Germany
-
- Stronghold Team
- Posts: 319
- Joined: Thu Apr 12, 2007 21:35
- Location: Germany
*Cough* http://files.filefront.com/Duke+Nukem+3 ... einfo.html *Cough* *Cough* 200MB *Cough*Tormentor667 wrote:Where can I get that?
-
- Posts: 40
- Joined: Tue Jun 06, 2006 15:43
- Location: Lithuania
-
- Developer
- Posts: 160
- Joined: Fri Apr 13, 2007 8:26
- Location: Germany
As a workaround you can estimate the pitch from the momentum of the rocket. I know that's a hack but this looks better than doing nothing.Graf Zahl wrote:This is a limitation of ZDoom. It doesn't set the pitch of the missiles so the model code doesn't know about it. I'll see if I can fix this in ZDoom because otherwise I'd have to maintain the changed code separately which I don't particularly want.
Just put
Code: Select all
// [BB] Workaround for the missing pitch information of rocktes.
if( spr->actor->GetClass( ) == PClass::FindClass( "Rocket" ) )
{
const double x = static_cast<double>(spr->actor->momx);
const double y = static_cast<double>(spr->actor->momy);
const double z = static_cast<double>(spr->actor->momz);
// [BB] Calculate the pitch using spherical coordinates.
const double pitch = atan( z/sqrt(x*x+y*y) ) / M_PI * 180;
gl.Rotatef(pitch, 0, 0, 1);
}
-
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
-
- Developer
- Posts: 160
- Joined: Fri Apr 13, 2007 8:26
- Location: Germany
I have to admit that the "actor == rocket" check is awful, but I don't see what's so bad about the idea in general for certain models. One could just add a PITCHFROMMOMENTUM flag to the model definition and let the model maker decide if the model benefits from the pitch estimation or not.
This is certainly not as good as if you would fix the ZDoom limitation, but IMHO it's better than keeping the pitch at zero for models where you can estimate the pitch.
This is certainly not as good as if you would fix the ZDoom limitation, but IMHO it's better than keeping the pitch at zero for models where you can estimate the pitch.
-
- Posts: 170
- Joined: Sun Jul 24, 2005 23:05
- Location: Republic, MO