full model rotation for missile models

Moderator: Graf Zahl

User avatar
Alex-bomber_Man
Posts: 56
Joined: Sat Aug 19, 2006 9:47
Location: Ukraine\Kharkov

full model rotation for missile models

Post by Alex-bomber_Man »

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?
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany

Post by Graf Zahl »

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.
User avatar
Nash
Developer
Developer
Posts: 1226
Joined: Sun Sep 25, 2005 1:49
Location: Kuala Lumpur, Malaysia

Post by Nash »

I've been meaning to request this too but never got around to it. It would be great if you can implement it Graf.
User avatar
Paul
DRD Team Admin (Inactive)
Posts: 1058
Joined: Thu Jun 30, 2005 13:30
Location: Poland - Grojec / Radom

Post by Paul »

Offtopic
Noticed this bug is also present in the Duke 3d Hi-res Resource Pack? ;)
User avatar
Tormentor667
Stronghold Team
Posts: 3555
Joined: Sun Nov 13, 2005 23:15
Location: Germany

Post by Tormentor667 »

Paul wrote:Offtopic
Noticed this bug is also present in the Duke 3d Hi-res Resource Pack? ;)
Where can I get that?
User avatar
KeksDose
Stronghold Team
Posts: 319
Joined: Thu Apr 12, 2007 21:35
Location: Germany

Post by KeksDose »

Tormentor667 wrote:Where can I get that?
*Cough* http://files.filefront.com/Duke+Nukem+3 ... einfo.html *Cough* *Cough* 200MB *Cough*
User avatar
Tormentor667
Stronghold Team
Posts: 3555
Joined: Sun Nov 13, 2005 23:15
Location: Germany

Post by Tormentor667 »

thx ;)
Devan
Posts: 40
Joined: Tue Jun 06, 2006 15:43
Location: Lithuania

Post by Devan »

Paul wrote:Offtopic
Noticed this bug is also present in the Duke 3d Hi-res Resource Pack? ;)
Some mods fix this using CON files in DN3D. For example, DeeperThought's DNWMD and Duke Nukem Arena. Really offtopic :)
User avatar
Torr Samaho
Developer
Developer
Posts: 160
Joined: Fri Apr 13, 2007 8:26
Location: Germany

Post by Torr Samaho »

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.
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.

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);
	}
after the gl.Rotatef command in gl_RenderModel.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany

Post by Graf Zahl »

Ugh...

Don't expect me to put such awful code into the renderer...
User avatar
Torr Samaho
Developer
Developer
Posts: 160
Joined: Fri Apr 13, 2007 8:26
Location: Germany

Post by Torr Samaho »

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.
The HavoX
Posts: 170
Joined: Sun Jul 24, 2005 23:05
Location: Republic, MO

Post by The HavoX »

The first rule in coding...

Do not be tempted into taking shortcuts by adding hacks!

Return to “Closed Feature Suggestions”