Skip to content

Touch spell hit detection targets the player when aiming downwards. #2768

@RedRoryOTheGlen

Description

@RedRoryOTheGlen

Firstly, with a touch spell readied, the expected behavior is that you are unable to cast it unless you have a target entity in range. But in practice, if you look slightly downwards (around 15-30 degrees below level) the touch spell can be cast.

Secondly, when casting touch spells on small enemies like rats where you have to look down to target them, you will commonly see the spell be cast, but the rat will not proc a spell save or any observable effect occur.

Using some debug gizmos with the touch spell targeting, I tried to figure out why this problem was occurring.

Casting a touch spell:
Image

Aiming downwards a bit more:
Image

Based on the DaggerfallMissile.GetEntityTargetInTouchRange method, it seems like the Touch spell spherecast originates a little bit behind the AimPosition. If the player looks downwards by a certain margin, the Touch spell actually collides with the player's own collider and sets them as the target. The spell is then cast and fizzles because the caster cannot be the target of the Touch spell.

This leads to instances where the player is trying to cast a touch spell on a rat or similar enemy and the casting animation is firing but no discernable effect (like a spell save) occurs.

SOLUTION:
This only seems to be a major problem with the player experience so I think adding a Layer Mask to the spherecast excluding the Player layer (as well as Ignore Raycast and Automap like in this other issue) would work if the player is the caster.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions