Blockland Forums > Modification Help

Sort of sight range search.

Pages: (1/3) > >>

otto-san:

What I'm trying to do is add something to gameConnection::onDeath that makes every player do a sort of search to see if they can see the player who died and who killed the player. There could also be a first, instant search and another search a bit later to confirm if they saw or not.

I'm thinking this is possible with raycasts or some container search of some sort, but I don't know where to begin to do this.

Chrono:

A raycast from each player's eyepoint to a lower point of the killed player.

I'm going to sleep or doing something else so if you'll need an example I'll get to that later.

otto-san:


--- Quote from: Chrono on July 06, 2011, 01:17:14 AM ---A raycast from each player's eyepoint to a lower point of the killed player.

I'm going to sleep or doing something else so if you'll need an example I'll get to that later.

--- End quote ---
I was thinking of a simple raycast but then it occured me that they'd have to be looking straight at the player.

Unless I'm not getting what you're saying.

Chrono:


--- Quote from: otto-san on July 06, 2011, 01:18:50 AM ---I was thinking of a simple raycast but then it occured me that they'd have to be looking straight at the player.

Unless I'm not getting what you're saying.

--- End quote ---
What I'm suggesting would work even if the player died behind you... so maybe it's not very ideal either.

Destiny/Zack0Wack0:


--- Quote from: Chrono on July 06, 2011, 01:19:46 AM ---What I'm suggesting would work even if the player died behind you... so maybe it's not very ideal either.

--- End quote ---
You can grab the position from the raycast collision and then work out if its within 180 degrees of the players eye point.

Pages: (1/3) > >>

Go to full version