Half Life Weapon Sway Created 4 years ago2019-09-28 04:37:13 UTC by Fadhil2314 Fadhil2314

Created 4 years ago2019-09-28 04:37:13 UTC by Fadhil2314 Fadhil2314

Posted 4 years ago2019-09-28 04:37:13 UTC Post #343169
Hey, I Wonder How To Add Weapon Sway For HL1
Like ThisLike This
Posted 4 years ago2019-09-28 09:15:27 UTC Post #343170
What game is that?
Posted 4 years ago2019-09-28 09:17:26 UTC Post #343171
Posted 4 years ago2019-09-28 10:14:14 UTC Post #343173
You have two options
1. Learn C++ and code it or borrow the code from another mod and squeeze it in your own (which still needs learning C++)
2. Find a coder

In essence this effect works by lagging the viewmodel in relation to player's eyes/camera.
Posted 4 years ago2019-09-28 11:33:35 UTC Post #343175
You'll need some programming knowledge.
I got some stuff written about that:

Introduction to Half-Life programming
Better view bobbing - basics of view swaying.

TL;DR
If you go the 1st route (the one that Bruce said), you'd need Visual Studio 2017 Community Edition, and preferably a HL SDK fork that works with VS 2017, like Solokiller's fork. (I mean, it doesn't really matter. You can use Visual Studio 6.0 from 1998, and HL SDK 2.3, but I'm saying VS2017 and a modified fork just because it's nicer to work in a modern environment)

Then you'll have to go to view.cpp on the clientside project, and do your maths there.
You'll get this sort of end result:
User posted image
If you want to achieve the Black Mesa style "weapon lag", like in the GIF, then you'll need to interpolate the angles, or alternatively, log a series of positions and use the last logged position, and that again, needs a bit of maths. :)

If you go the 2nd route, well, there isn't much to say there. Find a programmer to do it for you, or pay them (or don't, if they work for free).
Admer456 Admer456If it ain't broken, don't fox it!
Posted 4 years ago2019-09-29 00:33:06 UTC Post #343177
I Did, But It's Kinda Buggy

Sorry If Lag
Posted 4 years ago2019-09-29 08:16:01 UTC Post #343178
Looks good. What´s the problem?, try to play with values to get the effect you want. ;)
Posted 4 years ago2019-09-29 09:39:48 UTC Post #343179
I think the problem is, he wants to have so-called "lazy viewmodels". There, the viewmodel 'reacts' to changes in the view angles, by sort of lagging behind the current view angles.

You could log all subsequent angles into an array, then calculate a reaction based on that, or you could calculate the difference between the current and last view angles.

Do keep in mind that you'll have some problems with the yaw, since the yaw in view angles is -180 to +180. Once the last angle is 179, and the next angle is -179, the algorithm will think it's a difference of 358 degrees, which will "punch" your screen. I solved that somehow, can't remember exactly how I did it now.

So good luck. I might share some code later. Alternatively, look at Doom 3's view swaying code.
Admer456 Admer456If it ain't broken, don't fox it!
You must be logged in to post a response.