Doom3world

The world is yours! Doom 3 - Quake 4 - ET:QW - Prey - Rage
It is currently Sat May 25, 2013 3:30 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 19 posts ] 
Author Message
 Post subject: Head Anim While Reloading
PostPosted: Sun Feb 19, 2012 7:49 am 
Offline
picked up 75 health

Joined: Mon Feb 07, 2011 4:19 am
Posts: 81
Hey,
I always liked the "head anim" while reloading guns, I think the first game where this stuff has been implemented was Call Of Duty 2, actually almost all modern FPS implement it.
The anims of the weapons in D3 are good, but lack of this enhancement, so I decided to implement it.

Basically, the anim of the head is handled by a new bone in the weapon's view model, the bone "head". The angles of this bone are added to the view position of the player, so the code will detect the local orientation of this bone.
If this bone is not present, then the gun's anim will be like the old ones. This new bone should be the child of bone "origin", and it shouldn't have any child, to work properly.
With this hierarchy, the bone "head" will cause only the animation of the head, so the gun won't move.
Keep in mind that the orientation of this bone must be '0 0 0' in the default view. Also, the origin should be '0 0 0' too, just like the bone "origin". The code won't detect the origin of this bone, this mean that the head will be animated only by its current orientation.

This will help you to make the animation. You could link a camera to the bone "head", then assign one viewport to this camera.

Anyway, here the video I made to show you this stuff, http://www.youtube.com/watch?v=JVvaBVRf2gs

Here you can download the mod you saw in the video, http://www.mediafire.com/?xuy7c6ggx9sbo72

...And last but not least, I attach the source code, just search my name to see the stuff I implemented. Any suggestion will be appreciated :wink:

Cheers


Attachments:
Doom3_SDK_headanim.rar [73.53 KB]
Downloaded 82 times


Last edited by doomtrinity on Sun Mar 25, 2012 8:30 pm, edited 1 time in total.
Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Sun Feb 19, 2012 11:24 am 
Offline
found a secret

Joined: Tue Dec 16, 2008 10:34 pm
Posts: 636
That's really nice. I think that it has potential (not only for reloading).

_________________
:D


Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Thu Feb 23, 2012 9:04 pm 
Offline
picked up the chaingun

Joined: Sat Dec 25, 2004 2:58 pm
Posts: 172
Location: Germany
Hehe, very nice

_________________
http://www.d3opencoop.com


Top
 Profile  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Fri Feb 24, 2012 9:42 am 
Offline
is sad because his cool title went away
User avatar

Joined: Tue Aug 12, 2003 11:38 am
Posts: 724
Location: Underneath it all, waiting to get to the surface.
this is great

_________________
-->7318<--


Top
 Profile  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Fri Feb 24, 2012 3:12 pm 
Offline
picked up 75 health

Joined: Mon Feb 07, 2011 4:19 am
Posts: 81
=FF=Sturm wrote:
That's really nice. I think that it has potential (not only for reloading).

You are right, it will work with any weapon's anim ( e.g. fire, idle, random ), this mean that it could be used to implement new stuff in the gameplay.

Just a note, I guess that if you use this while firing, the projectile will go where you're looking at, not where the gun is aiming at ( since the gun should not be linked to the head ), anyway this should be fixed with "launchFromBarrel" in the projectile def.


Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Sun Mar 25, 2012 2:03 pm 
Offline
found a secret

Joined: Tue Dec 16, 2008 10:34 pm
Posts: 636
I would like to inform that the file is no longer online. Would you kindly upload it?

I've implemented the code in my project but somehow the head bone does nothing at all with displacement :/ (see next post)
Maybe I forgot something that it's inside the missing .pk4 (def, script files)

I'm using visual c++ 2010 express.
I can pm you the new build src code.


EDIT: It works, forgot to replace the dll lol

_________________
:D


Last edited by =FF=Sturm on Sun Mar 25, 2012 5:12 pm, edited 5 times in total.

Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Sun Mar 25, 2012 4:01 pm 
Offline
found a secret

Joined: Tue Dec 16, 2008 10:34 pm
Posts: 636
Edit: First problem solved

As you can see, the bone it's actually there [ "head" ]. It's controlled by two keys. ('q' & 'e') script wise.
This is supposed to be a cover system.

edit: just out of curiosity, Does it actually take care of its DISPLACEMENT ? If so that's the problem.

how is it possible to take care of the displacement?


I guess it's basically the same but with firstPersonViewOrigin to firstPersonViewWeaponOrigin
Thanks


Edit: sorry for the crappy screen


Attachments:
bonehead.png
bonehead.png [ 305.15 KB | Viewed 145 times ]

_________________
:D
Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Sun Mar 25, 2012 9:13 pm 
Offline
picked up 75 health

Joined: Mon Feb 07, 2011 4:19 am
Posts: 81
Hey,

Sadly the code won't detect the current position of the bone "head", this means that the head is animated only by the current orientation of that bone.

Anyway, it should not be complicated to add that stuff in the code, I haven't implemented the detection of the origin just cause my only purpose was to enhance the anims.

Take a look to this code in "Player.cpp",
Code:
/*
===============
idPlayer::GetViewPos
===============
*/
void idPlayer::GetViewPos( idVec3 &origin, idMat3 &axis ) const {
   idAngles angles;
   idAngles headAnimAngle;      // doomtrinity

   // if dead, fix the angle and don't add any kick
   if ( health <= 0 ) {
      angles.yaw = viewAngles.yaw;
      angles.roll = 40;
      angles.pitch = -15;
      axis = angles.ToMat3();
      origin = GetEyePosition();
   } else {
      origin = GetEyePosition() + viewBob;
      //angles = viewAngles + viewBobAngles + playerView.AngleOffset(); // doomtrinity - commented out
// doomtrinity -->
      if ( weapon.GetEntity()->HasHeadJoint() ) {
         headAnimAngle = weapon.GetEntity()->GetHeadAngle();
         angles = viewAngles + viewBobAngles + headAnimAngle + playerView.AngleOffset();
         //gameLocal.Printf( "calculate head anim\n" );
      } else {
         angles = viewAngles + viewBobAngles + playerView.AngleOffset();
         //gameLocal.Printf( "DO NOT calculate head anim\n" );
      }      
// <-- doomtrinity

      axis = angles.ToMat3() * physicsObj.GetGravityAxis();

      // adjust the origin based on the camera nodal distance (eye distance from neck)
      origin += physicsObj.GetGravityNormal() * g_viewNodalZ.GetFloat();
      origin += axis[0] * g_viewNodalX.GetFloat() + axis[2] * g_viewNodalZ.GetFloat();
   }
}

I guess we can detect the origin of that bone by modifying the calculation of the variable "origin". Actually, there may be other stuff we should modify, in order to get your idea work properly, anyway I'll make a test :wink:

BTW, now the link in my first post works again, dunno why mediafire removes the files so early.

Cheers


Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Sun Mar 25, 2012 10:07 pm 
Offline
found a secret

Joined: Tue Dec 16, 2008 10:34 pm
Posts: 636
Yeah, that's exactly what I ment. I noticed that the code was actually for rotating only, but seeing that It can be enhanced with more advance stuff...

About mediafire, i don't know why they remove so early files :/

Lookin forward.
:mrgreen:

_________________
:D


Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Mon Mar 26, 2012 11:46 am 
Offline
Last man standing
User avatar

Joined: Fri Jan 07, 2005 12:27 am
Posts: 1050
I didn't expect that to make such a difference, but it's really cool.


Top
 Profile  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Tue Mar 27, 2012 11:12 am 
Offline
is sad because his cool title went away
User avatar

Joined: Tue Aug 12, 2003 11:38 am
Posts: 724
Location: Underneath it all, waiting to get to the surface.
is this new cover system a type of leaning? in dark mod they have the full leaning you can look at their code.

_________________
-->7318<--


Top
 Profile  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Tue Mar 27, 2012 3:18 pm 
Offline
found a secret

Joined: Tue Dec 16, 2008 10:34 pm
Posts: 636
It's more than that. It's something really powerful. But it still needs to take care of the displacement.Once is that, the next gameplay stuff is possible.
Leaning is just one of the applications.

Let's say that you can "control" the "camera" of the player as you "wish". From both it's position and rotation via a bone that it's in the md5mesh.

With that said, you can bind keys/impulses to call 'I' functions script wise that contain each animation. This allows any cover system, independent weapons on hands behaviour, a fast look to the left/right without mod the pos of the player (in case of a racing game or whatever), a fast stab with a sword in first person to someone on your back... and so many other examples.

The best thing is that you can do all that stuff with just md5anims and a few script experience lol.

_________________
:D


Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Tue Mar 27, 2012 11:17 pm 
Offline
is sad because his cool title went away
User avatar

Joined: Tue Aug 12, 2003 11:38 am
Posts: 724
Location: Underneath it all, waiting to get to the surface.
yes but, I bet this should be more realiable within the c++ code, because you will probably end up with a lot of threads working alongside, and doom3 doesn't seems to be that realiable with a lot of threads going on, isn't it?
that was one of my reasons reasons to change the portalSky code from scripting to c++ because there I had more precission and the code in the end is less resource intensive.
anyways I'm bloody interested on seeing what do you come out with. :mrgreen:

_________________
-->7318<--


Top
 Profile  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Sat May 19, 2012 9:36 pm 
Offline
is connecting to Doom3world.org

Joined: Sat May 19, 2012 9:35 pm
Posts: 2
Hey, I was curious. Is there anyway I can integrate your great mod in with another at all? Say, sikkmod


Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Sun May 20, 2012 5:15 am 
Offline
picked up 75 health

Joined: Fri May 04, 2012 12:40 am
Posts: 88
Location: Wales
I don't like it, it distracts the camera movement, the game camera should always be focused and controlled by the player, specially in a Multiplayer game.


Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Sun May 20, 2012 5:48 pm 
Offline
picked up 75 health

Joined: Mon Feb 07, 2011 4:19 am
Posts: 81
@Dictator93
You can integrate it in any mod you want, but keep in mind that I only made the anims for these 3 weapons just to show you how it works, all the other weapons still have classic reload.

@Gir
The only game where this is not good, in my opinion, is Quake 3 Arena ( and all the other "fast" FPS ). And BTW, usually you cannot do anything while you're reloading, so this won't affect the control of the camera too much, anyway I understand that someone may not like this.


Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Mon May 21, 2012 2:36 pm 
Offline
picked up the chaingun
User avatar

Joined: Mon Jul 18, 2011 5:58 am
Posts: 193
Are you going to animate the missing weapons also? That would be a cool mod to play with, even better if we add it to general enhancement mods like sikkmod, as dictator93 said.

_________________
FFYL
------
Doom 3: S.T.A.R 1088


Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Tue May 22, 2012 3:19 am 
Offline
picked up 75 health

Joined: Mon Feb 07, 2011 4:19 am
Posts: 81
Nope, this is intended as modder resource, Doom 3 had its good times for Doom-specific mods but...I'd like to make a mod ( a new game ) which will include all the features I made and the ones I'm planning to make.
However, I may consider to implement this stuff for all weapons in the spare time.


Top
 Profile E-mail  
 
 Post subject: Re: Head Anim While Reloading
PostPosted: Tue May 22, 2012 7:20 am 
Offline
missed 400 shots

Joined: Tue Dec 06, 2011 8:05 pm
Posts: 418
Quote:
I don't like it, it distracts the camera movement, the game camera should always be focused and controlled by the player, specially in a Multiplayer game.


I really do like it, if the player can still move his head around, I think its fine since you aren't really focusing on anything when your reloading(you should be hiding, or moving around avoiding things that are trying to kill you).

As a modding resource, you really need to quickly type up a step by step on how to incorporte this into a virgin codebase(yeah you marked your code changes, but not many people will want to go through a ton of source files to figure out what needs to get added unless its freakin damn awesome, like drag and drop this in to get Skyrim quality graphics in your game).


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group