Weapon Bobbing (implemented in OGSR's codebase)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.6k
- Forks
- 536
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 3
Description
Is your feature request related to a problem? Please describe.
No problem whatsoever, would just like to see it implemented into Open X-Ray as an optional feature, just like how it is in OGSR.
Describe the solution you'd like
A global weapon/hand bobbing effector, which "bobs" the hands from 1 angle to another, similar to how it was done in old Lost Alpha and Oblivion Lost trailers. It works globally, as in the weapon animations will play alongside it.
It is implemented into xrGame.dll, authored by @joye-ramone, committed by @xrSimpodin :
public:
class CWeaponBobbing
{
public:
CWeaponBobbing() = delete;
CWeaponBobbing(CHudItem* parent);
~CWeaponBobbing() = default;
void Update(Fmatrix& m, Fmatrix& m2);
void CheckState();
private:
CHudItem* parent_hud_item;
float fTime;
Fvector vAngleAmplitude;
float fYAmplitude;
float fSpeed;
u32 dwMState;
float fReminderFactor;
bool is_limping;
bool m_bZoomMode;
float m_fAmplitudeController;
float m_fAmplitudeRun;
float m_fAmplitudeWalk;
float m_fAmplitudeLimp;
float m_fSpeedRun;
float m_fSpeedWalk;
float m_fSpeedLimp;
float m_fCrouchFactor;
float m_fZoomFactor;
float m_fScopeZoomFactor;
};
std::unique_ptr<CWeaponBobbing> m_bobbing;
It is then configurable in gamedata\configs\misc\effectors.ltx in the below example (parameters are variable of course):
[wpn_bobbing_effector]:bobbing_effector
crouch_k = 0.75
;zoom_k = 0.1
scope_zoom_k = 0.1
controller_amplitude = 0.003 ;0.002
Describe alternatives you've considered
The only other alternative would be to re-animate all vanilla Call of Pripyat weapons (or any other weapon pack) by hand (in Blender or similar) individually, which would take a lot more effort and time to complete and test. This would also imply that the weapon animations would be forced for the player, and not configurable (as in, the bobbing requested can be disabled via config if needed).
Additional context
Videos like below (from OGSE/OGSR) will show what I mean:
https://www.youtube.com/watch?v=zBtbNJJi7mk (OGSE v0.6.9.3)
https://youtu.be/XvFCJM5z-38?t=337 (timestamp, OGSR)
https://youtu.be/8-3CgwDObCs (an old build video, hands bobbing within)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the referenced CWeaponBobbing interface and the HUD-item integration in xrGame.dll, then inspect gamedata\configs\misc\effectors.ltx for existing effector configuration. Compare the requested optional behavior with the OGSR implementation and videos; the work is complete when global weapon bobbing is configurable and works alongside weapon animations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100