OpenArena Message Boards

id Tech 3 => Engine => Topic started by: bbmario on January 11, 2015, 06:59:15 PM



Title: Weapon model sway in camera movement
Post by: bbmario on January 11, 2015, 06:59:15 PM
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.


Title: Re: Weapon model sway in camera movement
Post by: fromhell on January 11, 2015, 07:15:54 PM
I totally understand what you're trying to do and it's also something I really want in OA too.  BTW this is totally a cgame thing, not engine, so I might move this.

It's a bit harder to implement since cgame handles the viewmodel very differently than Quake and all derivatives (Source engine included) afterward.  I tried to implement a port of Engoo's figure 8 bobbing (unreal-esque) in cgame in the leixperimental repository (https://github.com/OpenArena/leixperimental) and failed.  I did however, manage to 'port' the old Quake bobbing code which goes well with a centered gun :)

Darkplaces has weapon swaying/leaning like Source fyi (cl_leanmodel / cl_followmodel), though I see it more as a Quake2 feature.   Generally the idea is to lowpass/highpass the old origin and angles instead of absolutely setting its value. Engoo partially implemented the Darkplaces code, but simplified and without low/highpasses (which I couldn't get to work).  for either engine, check view.c


The problem: In Q3, viewmodel is always 0,0,0.   In Q1, it's the vieworigin (coordinates being 22 units above the player's crotch in the map).  IIRC


Title: Re: Weapon model sway in camera movement
Post by: bbmario on January 12, 2015, 04:42:21 AM
Good research material i managed to find: http://docs.cryengine.com/display/SDKDOC4/Procedural+Weapon+Animations