Weapon model sway in camera movement

Locked
vinny
Posts: 57
Joined: Sun Feb 20, 2011 12:25 pm

Weapon model sway in camera movement

Post by vinny »

I'm trying to create an effect similar to the one implemented in TF2: https://www.youtube.com/watch?v=4wPAzutIVpc

Note that this is not player model bobbing, it's just a subtle effect on the camera and the model itself, slowly reaching the new view target. I could not find any documentation on this topic around the internet and i suspect there's some heavy math behind this and it would be nice if someone here has any idea on how to implement that kind of code. Or, at least, can give me some good directions on the topic. Thanks! :D
vinny
Posts: 57
Joined: Sun Feb 20, 2011 12:25 pm

Re: Weapon model sway in camera movement

Post by vinny »

Any ideas? :D
Ganemi
Posts: 564
Joined: Thu Apr 21, 2005 12:57 pm

Re: Weapon model sway in camera movement

Post by Ganemi »

Something similar to this?

https://www.youtube.com/watch?v=jtnC9bEMvHE

You might need to do it somewhere around cg_offsetfirstpersonview

You need to create a position vec3_t for the weapon, and modify it based on the angular velocity of your player, which means you would need to store the last ps_viewangles in your cg_t, I think. Whatever the case, you need angles info from the previous frame to determine how much to offset the view weapon.

And this is all only if you're trying to do this as an aesthetic, and not something that actually influences the muzzle origin, which is a lot more complicated.

Do you have any code written so far?
Locked