Forum Discussion

voytek.lorenc's avatar
10 months ago
Solved

Mobile Aim Assist Question

I'm working on implementing Aim Assist in my game and it's mostly going well.  I am at a stage where I need to be able to identify the player that is closest to the aiming direction of another player.

The Aim Assist Documentation explains  "Consider the game Super Rumble as a usage example. A system could be created that gathers a list of all players currently in play. The system could then periodically iterate through the list of players to find the player closest to the aiming direction of an individual with aim assist, and then set this player as the aim assist target."

How do I find the player who is "closest to the aiming direction of an individual" ?  

  • On each async interval I would use a world.getPlayers().forEach loop to evaluate through all players to determine which has the greatest dot product between the look direction towards each player and the forward aiming direction. This result would use both the lateral and vertical axis to determine who is most in your sights, and you could also set a threshold to ignore aim assist if the max result is still less than a tolerance of say 0.90.

3 Replies

  • On each async interval I would use a world.getPlayers().forEach loop to evaluate through all players to determine which has the greatest dot product between the look direction towards each player and the forward aiming direction. This result would use both the lateral and vertical axis to determine who is most in your sights, and you could also set a threshold to ignore aim assist if the max result is still less than a tolerance of say 0.90.

    • SeeingBlue's avatar
      SeeingBlue
      Mentor

      Dot product is an excellent solution for this.
      I also wonder if something similar could be achieved with a raycast, if the ray hits a player anywhere on the body, then snap to the chest?