I had a question; I’m aware that most of these stream the video to everyone on the server. I was however, wondering if there was one or someway to make it so it only streamed to those actually looking at the object it is being displayed on. I just thought it would be more convenient for most purposes, also perhaps it would open up possibilities to more then one user of these objects at a time.
Pretty sure it’s possible, I’ve seen something similar done on the GMTower gamemode.
How it would be done, I’m honestly not sure, I still need take a deeper look into video streaming.
I’m sure there’s someone who may be able to give you a better idea how.
Some of the media players start when you “walk through a doorway”, others start based on how close you are. It wouldn’t be hard to make one only play when you’re looking at it.
Couldn’t you just use the EyeTrace function or something similar like that? Check if the player is looking at the item? It seems easy if you already have a streaming addon, just check the eyetrace?
Any slight jump in aiming could result in the media being turned off which would likely be annoying. From my experience creating Cinema, I’d suggest either creating a location system or doing some sort of distance check. In the case of a location system, when the player enters a room with a media player, just subscribe them to updates, etc. When they leave, unsubscribe them.
[editline]27th March 2014[/editline]
If you want some example code, here’s what I did for the Cinema gamemode:
Of course, this example uses a custom location system.
Okay. I just need to look into how media players in GMod are made now, thank you.
Instead of using location, and a direct eye trace looking at the object, use a generalized area sweep.
Example: Based on where the screen is, and if it’s facing the placer from the players location, and the player is looking in the direction of the monitor then play.
This would still be true if the hit the mouse and bumped it so it’s slightly off screen, the amount it can be off-screen could vary depending how you code it. You could make it so you have to be 90 degrees left, or 90 degrees right to disable it. That’s a big area. Add that check in with distance and you’d have something nice.
Here’s the kicker, when it’s activated, don’t do a check in think / every frame. Only check for disable every 1-3 seconds. Same with when it’s not activated, only do checks if they’re close by ( example: If the distance is > x, then next time to check distance is 1-3 seconds away – When they are within the general vicinity, lower the time between updates to 0.25 - 0.5 seconds, reducing it as they get closer until they activate it. Once activated raise it up for deactivate )