Micromod: Crosshair Accurate Weapon Firing 1.3

Projects that alter game functions but do not include new maps belong here.
Forum rules
The Projects forums are ONLY for YOUR PROJECTS! If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.

Micromod: Crosshair Accurate Weapon Firing 1.3

Postby Ivory Duke » Wed Dec 04, 2019 8:51 am

I AM NO LONGER INVOLVED IN DOOM MODDING, YOU ARE FREE TO USE THIS A YOU PLEASE (JUST MENTION MY NAME SOMEWHERE IN THE CREDITS OUT OF CURTESY).
Inspired by the brilliant work of m8f on his Precise Crosshair mod I decided to write a simple function that dynamically adjusts weapons' projectile firing functions' pitch and angle to make it so that projectiles and hitscans always hit the crosshair.
From my testing everything seem to work as intended so I am releasing an example pk3 for modders

DOWNLOAD EXAMPLE PK3 (to be used with QC:DE)
All the firing functions examples are in ZScript.QCD

Code: Select allExpand view
Changelog 1.3:
- better procedure;
- added an example pk3 to be used with QC:DE.

Changelog 1.2:
- simplified angle/pitch calculation code (VectorAngle duh!);
- fixed an issue where depending on the pitch at which you fired a non hitscan projectile it would warp to a different location after impacting with a solid surface. (I would very much love to record a video of what I mean but I am not going to be on my main computer for a few days)

Changelog 1.1:
It has been kindly brought to my attention that it is better to make the function calculating Angle and Pitch an Action, so the code has been slightly tweaked to make it work that way.
I think it looks nicer and more compact


STEPS FOR MOD IMPLEMENTATION:
Spoiler:


The way it works is quite simple, a line tracer (a non damaging hit scan attack of sort) is fired at your viewheight and is used to return the distance it traveled.
This distance represents the projection of the crosshair onto the map geometry.
Then basic trigonometry is used to determine which are the angle and pitch necessary to make the fired projectile travel toward the point of impact from the XY and Z offset you make it spawn at.

Here is a basic demonstration of it applied to a few of QC:DE's weapons I edited to use it.
Last edited by Ivory Duke on Sun Nov 15, 2020 10:46 am, edited 5 times in total.
User avatar
Ivory Duke
Not an actual duke
 
Joined: 17 Jun 2019

Re: Micromod: Accurate to Crosshair Weapon Firing 1.1

Postby Ivory Duke » Wed Dec 04, 2019 4:09 pm

1.1 update, no functional change. Just been told this way is better
User avatar
Ivory Duke
Not an actual duke
 
Joined: 17 Jun 2019

Re: Micromod: Crosshair Accurate Weapon Firing 1.2

Postby Ivory Duke » Fri Dec 06, 2019 8:24 am

1.2, now non hitscan projectiles are always accurate at all firing pitches
User avatar
Ivory Duke
Not an actual duke
 
Joined: 17 Jun 2019

Re: Micromod: Crosshair Accurate Weapon Firing 1.3

Postby Ivory Duke » Thu Feb 13, 2020 9:49 am

1.3 now with a playable example
User avatar
Ivory Duke
Not an actual duke
 
Joined: 17 Jun 2019


Return to Gameplay Mods

Who is online

Users browsing this forum: HLRaven, stainedofmind and 15 guests