Screen Space Aim Assist

Post your coolest Hexcasting creations here.

New topics are NOT for chatting or asking help, put those in the comments of a post or in a different forum.
_ae
Posts: 4
Joined: Fri Feb 17, 2023 12:36 pm

Screen Space Aim Assist

Post by _ae »

This is a useful phrase I keep in my spellbook for targeting entities, which selects the entity from a list closest to my crosshair (based on the average position of the entity's feet and head), within a given viewcone. It makes use of a few other utility phrases, which I've included as their own patterns below.

______________________________________________________________________________________________________
dadaddww
Clean Thoth (list<pattern>, list → list)
Thoth, but only the iotas at the top of the stack are included in the returned list. Useful if thoth is required for a phrase part way through a spell which needs to maintain a stack.
aawddqqqqwaeawqaeaqaewdqdweqqqaedeNumerical Reflection: 0deeedeeeqaeaqaawdddadad
______________________________________________________________________________________________________
wdewqaw
Inverse Screen Space Distance (vector → num)
Used instead of view angle relative to the crosshair because there's no native atan2 function, this doesn't require a conditional, is simple to calculate, and because it's monotonic with respect to view angle which is all we really want.
qaqaawddwqaqwaaaeddaadadaawwaqawddqddwedewaaeaawddwwqaqwwdedw
______________________________________________________________________________________________________
awawaa
Argmax (list<num> → num)
Gets the index of the largest value in a list. Also saves a copy of that value to the ravenmind as a side effect, which can be useful.
aadaaNumerical Reflection: 0deeedeqqwawqaawqqqaadaaqeewdweddweqqqeqqwawqaaweeeqqqBookkeeper's Gambit: Drop 1eeeawdddeaqqeeeaaedddadadBookkeeper's Gambit: Drop 1qeewdweddwdedqde
______________________________________________________________________________________________________

Aim Assist (list<pattern>, num, list<entity> → )
Takes a list of patterns which are to be executed on an entity, a threshold value (where 0 is anything in front of you, 1 is a 90 degree cone, 2 is a 45 degree cone, etc.), and a list of entities. It then executes the patterns on an entity chosen by aim assist. Does nothing if no entity is within the given threshold. Patterns in red below are convenient examples; including them in the spell changes the type to (list<pattern> → ). Note that your own location in screen space is undefined, so this will throw a divide-by-zero mishap if you include yourself in the entity list!
Numerical Reflection: 4qaqaaNumerical Reflection: 32qqqqqwdeddwqqqqaadaaddaawddaawaawNumerical Reflection: 2wdedwwdewqaweeeaaedddadaddwwawawaadeeedaawddqeewdweddwqqqqaawdddeaqqeeeqqqBookkeeper's Gambit: Drop 2eeeawdddeaqq
Last edited by _ae on Thu Feb 23, 2023 10:48 am, edited 4 times in total.
_ae
Posts: 4
Joined: Fri Feb 17, 2023 12:36 pm

Re: Screen Space Aim Assist

Post by _ae »

Finally had the opportunity to check what I had in-game; fixed any errors above and replaced escapes with parentheses since they're easier to keep track of when nested.
Talia
Posts: 6
Joined: Fri Dec 02, 2022 12:02 am

Re: Screen Space Aim Assist

Post by Talia »

I've used this to power a mist-dispersal hex, and wow it is so much easier to use than a raycast! Plus the Clean Thoth and Argmax will be very handy to have as well, so thanks for making this!
User avatar
petrakat
Posts: 10
Joined: Fri Dec 02, 2022 12:02 am

Re: Screen Space Aim Assist

Post by petrakat »

...there's no native atan2 function...
Whoopsy 8-) I've opened a bug report, #422
The creator of petrak@'s mods. Partially a test account, partially for me to chat in a non-admin capacity... probably just a test account.
_ae
Posts: 4
Joined: Fri Feb 17, 2023 12:36 pm

Re: Screen Space Aim Assist

Post by _ae »

I wouldn't call that a bug, but if you add it I certainly won't complain! :D
User avatar
petrakat
Posts: 10
Joined: Fri Dec 02, 2022 12:02 am

Re: Screen Space Aim Assist

Post by petrakat »

Issue report, then :D

It's good for me to have a bunch of small things I can implement to keep me from getting burned out on any one particular part of development. (Speaking of .... time to get back to work on the casting context refactor)
The creator of petrak@'s mods. Partially a test account, partially for me to chat in a non-admin capacity... probably just a test account.
_ae
Posts: 4
Joined: Fri Feb 17, 2023 12:36 pm

Re: Screen Space Aim Assist

Post by _ae »

Oh, now I see why you made it a bug report! I didn't know it was already supposed to be implemented, thought you just saw that offhand comment and decided to add it :lol: