Make a prop rotate to face the player?

  • If you're asking a question make sure to set the thread type to be a question!

Hosomi

L3: Member
Jun 15, 2016
130
40
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
515
Which player? There can be between zero and thirty two of them to choose from.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
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
698
764
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
64
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
515
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
64
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,013
347
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
515
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.