Skript look detection?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

SwiftKraft

Member
Dec 13, 2020
2
0
1
Is it possible to detect whether or not an entity is in anyone's view? I am making an SCP server so I want to use skript to make SCP-173, which moves when you don't look at it. Can someone show me, if its possible, the concept.
 
This is not really possible. Each player might have different FOV, render distance and aspect ratio. You can't obtain information about client side options on your server. Also there is F5 toggle perspective option, which makes this even harder.

But the idea is:
You know player position and rotation, SCP position and rotation. Based on those information you can apply perspective projection. You have to calculate perspective projection matrix which requires player FOV, render distance and aspect ratio (you could use some default values). Then you just check calculated position against screen (`x > 0 && x < 1 && y > 0 && y < 1 && z > 0`). This requires a lot of math and the result would not be as good as you imagine.
 
I have an idea: an invisible armor stand spawns at ^5 ^ ^ of the player when he joins and consistently teleports to that position, but the problem is, that how could I do it on multiple players?
 
I have an idea: an invisible armor stand spawns at ^5 ^ ^ of the player when he joins and consistently teleports to that position, but the problem is, that how could I do it on multiple players?
How would that solve the problem?

You could just create array with all armor stands for each player and loop through the array to keep them updated.
 
Status
Not open for further replies.