Make a prop rotate to face the player?

  • Site Migration: See bugs? Report them here. Want something changed or have an idea? Suggest it here.

Hosomi

L3: Member
Jun 15, 2016
130
First off, is it even possible?
I considered using a point_anglesensor to acquire angles to set on the prop, but this requires a specified entity name, I don't even know if the player has an entity name.

I want to achieve an effect similar to the npc_security_camera in Portal and Portal 2
 

henke37

aa
Sep 23, 2011
2,075
Which player? There can be between zero and thirty two of them to choose from.
 

Pocket

Naylte ven, naylte yen.
aa
Nov 14, 2009
4,652
I was gonna say. Even if the code they used to handle the Portal cameras (and the wall-mounted Half-Life 2 turrets—less far fetched since every Source game is essentially an HL2 mod) were in the game and functional, it probably doesn't work in multiplayer.
 

Izotope

Sourcerer
aa
May 13, 2013
700
I was gonna say. Even if the code they used to handle the Portal cameras (and the wall-mounted Half-Life 2 turrets—less far fetched since every Source game is essentially an HL2 mod) were in the game and functional, it probably doesn't work in multiplayer.
They work in Portal 2 COOP, probably just following the nearest player.
 

[Rx.] Christian Troy

L5: Dapper Member
Jan 23, 2017
223
What does Portal call the player? Sometimes it's the same for tf2 but not always. I know for triggers it would be !activator but not sure if that applies to this.
 

henke37

aa
Sep 23, 2011
2,075
The source engine has the !player magic entity name. But it only works in singleplayer games.
 

[Rx.] Christian Troy

L5: Dapper Member
Jan 23, 2017
223
Not sure why I didn't think of it earlier. What is the entity that a sentry locks onto? This kinda interesting as the OP has a cool idea.
 
Mar 23, 2013
1,015
You can give a player a "targetname". I dont know if that helps, just throwing it in here.

To give a player a targetname give him this input: addoutput targetname <NAME>

I hope thats the right syntax. Giving player targetnames is very experimental and might not work on heavily modded servers. I dont even know if it can be a solution to the problem but perhaps this angle entity thing can make use of the targetname though you probably need to make it in a way that only one player has that targetname at a time.
 
Last edited:

henke37

aa
Sep 23, 2011
2,075
Also, you need to know which player entity to send the input to in the first place. Which kinda loops back to the original problem.