Skip to content

Fix cone projectile aiming in third person (free aim and target lock)#7

Open
zspatter wants to merge 2 commits into
ersh1:masterfrom
zspatter:fix/cone-projectile-aim
Open

Fix cone projectile aiming in third person (free aim and target lock)#7
zspatter wants to merge 2 commits into
ersh1:masterfrom
zspatter:fix/cone-projectile-aim

Conversation

@zspatter

@zspatter zspatter commented Jul 8, 2026

Copy link
Copy Markdown

Addresses #6.

Two independent commits, intentionally kept separate so they can be cherry-picked individually:

1. Support cone projectiles in target lock aim types

Minimal extension of the existing pattern: installs the GetLinearVelocity hook on RE::VTABLE_ConeProjectile[0] (cones have their own vtable, so the base Projectile hook never fires for them) and maps FormType::ProjectileCone to uTargetLockMissileAimType in ProjectileAimSupport. With this, predict and homing behave for cone projectiles the way they already do for missiles. No new settings and no MCM changes.

2. Aim player cone projectiles at the crosshair in third person

Fixes the free aim case. The engine derives the launch direction of player-fired missiles/arrows/beams from the camera, but cone projectiles launch with the shooter's body pitch. Since the free camera keeps camera pitch in freeRotation.y without syncing the character's pitch (UpdateFacingCrosshair transfers yaw only), cones miss the crosshair, with error growing with distance.

The fix re-aims player-fired cone projectiles along the camera-crosshair raycast in InitProjectile, reusing the exact approach (and constants) of the existing mounted aiming block, gated to: player shooter, cone form type, IsFreeCamera(), third person camera state, and either no target lock or lock with the free aim setting. Notes:

  • The f3PArrowTiltUpAngle tilt from the mounted block is intentionally omitted: cones get no engine-side crosshair correction that would compensate for the tilt, so the exact ray direction is what should be flown.
  • Vanilla-castable cones (Flames etc.) are short range spray effects where this is invisible; the case that matters is long-range cone projectiles used by spell mods for their pierce-through-actors behavior (Astral Magic 2's Astral Spear line, Piercing Expert Spells, both with 10k-90k unit ranges).

Testing status

Full disclosure: I authored this against the patterns already in the codebase and it compiles clean in CI, but I have not yet done an in-game runtime test of these builds. I did verify the diagnosis in-game extensively (cone spells miss high in third person free aim and target lock, are accurate in first person, and accurate with TDM removed - details in #6). Happy to run the CI artifact through in-game testing if you'd like that before considering this, or feel free to treat this PR as a reference implementation for #6 and rework it as you see fit.

zspatter added 2 commits July 7, 2026 21:53
Cone-type projectiles were never redirected during target lock: the GetLinearVelocity hook was not installed on ConeProjectile's vtable, and ProjectileAimSupport's form type switch fell through to free aim for them. Install the hook and map cones to the spell/missile aim type setting so predict and homing work for cone projectiles the same way they do for missiles.
The engine launches cone projectiles using the shooter's body pitch rather than the camera aim pitch. With the free camera active, the character's pitch is not synced to the camera (UpdateFacingCrosshair only transfers yaw), so player-fired cone projectiles miss the crosshair, with the error growing with distance. Missiles, arrows and beams are unaffected because their launch direction is derived from the camera.

Re-aim cone projectiles along the camera-crosshair raycast at launch, using the same approach as the existing mounted aiming correction in InitProjectile. The arrow tilt-up angle is intentionally not applied since cones receive no engine side crosshair correction that would compensate for it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant