Need help with getting a players line of sight.

Discussion in 'Plugin Development' started by ItzFeff890, Nov 8, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ItzFeff890

    Ok, so have any of you seen the plugin Minecraft: The Last Airbender. Commonly knows has: Bending. When you airblast someone it blasts them back. I was wondering if anyone knew how to do that. Basically I need a method to check if an entity is in your line of sight, and if it is then it will do something to them.
     
  2. Offline

    mine-care

    Get eye location of a player, and loop through all the locations front of him, then change velocity of players in that region.
     
  3. Offline

    Avygeil

    ItzFeff890 Get nearby entities within a radius, get the player's direction Vector, and for each entity, create a 2nd Vector between the player and them. Use Vector#angle to check if they are "relatively" in the line of sight. Since I'm guessing the radius will be quite low, this method won't suffer from high distance. Something like the default fov should do it (can't remember what it is, something like 70°).
     
Thread Status:
Not open for further replies.

Share This Page