Ed the Bat and I made a little mod that allows railguns to use autoaim!
This works by:
Firing a 0-damage bullet that is assigned a TID, which uses autoaim.
Calculating the pitch from which the A_RailAttack needs to be fired based on the player's position and the puff's position.
Returning the pitch to the call to A_RailAttack on the weapon, which has the RGF_EXPLICITANGLE flag set.
This creates a RailAttack which conforms to the user's autoaim settings.
Other than using this for autoaim, one could create a weapon that uses an angled sprite and shoots an angled RailAttack that hits where the player is aiming. Provisions for this were started but weren't finished.
There are a couple of known bugs:
Two bullet chips are created per attack if you allow the weapon to use decals.
Over long distances, the attack is wildly inaccurate, due to conversion between floating point and fixed point values.
The original version of this resource used a feature from the ZDoom's development branch, which was GetActorProperty's APROP_AttackZOffset. A user requested that I make it compatible with the current stable version of ZDoom.
So here it is! If you have a player class that uses a different AttackZOffset, you'll need to account for that when implementing the script. I added in a constant which takes care of that so it's not a big deal, just change the value and recompile.
You do not have the required permissions to view the files attached to this post.
Nash wrote:Nice work, but I wonder what's stopping this from being implemented natively? Seems like something really basic and trivial that it should be addressed at the source level... :S
I'd been told a couple of times that it would, indeed, be simple to add. But, as you can see, two years later it hasn't happened. Without the help of Epic, I still wouldn't have my armor-piercing gun that honors autoaim.