Getting Eye Angle of player

Please post any questions about developing your plugin here. Please use the search function before posting!
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Getting Eye Angle of player

Postby arawra » Sat May 10, 2014 8:44 pm

What I would like to do is compare the eye angle of two players to determine if a player is behind another. I'm not seeing any properties in PlayerEntity for this, and was wondering if the functionality exists.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat May 10, 2014 8:57 pm

You can use the links in this thread to see the "sp dump server_classes" output for the given games (though some might need updating). Just because we don't have the send property assigned to PlayerEntity doesn't mean it doesn't exist. That just means we haven't added support for in the BaseEntity structure.
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Postby arawra » Fri May 16, 2014 11:44 am

Would I have to scan the signature for "float m_angEyeAngles[0] (offset 8404)" in CCSPlayer, or is there a way to interact directly with CCSPlayer in Python?

Tried using:

Syntax: Select all

PlayerEntity(player)._get_property('m_angEyeAngles[0]')
PlayerEntity(player)._get_property('m_angEyeAngles')[0]
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Postby arawra » Fri May 16, 2014 12:27 pm

Got it.

PlayerEntity(player).eye_angle_x
PlayerEntity(player).eye_angle_y
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Fri May 16, 2014 12:34 pm

You could either access the eye angle by using (<edict>.get_prop_float('m_angEyeAngles[0]'), <edict>.get_prop_float('m_angEyeAngles[1]'), <edict>.get_prop_float('m_angEyeAngles[2]')) or by using PlayerEntity.

Syntax: Select all

from players.entity import PlayerEntity

player = PlayerEntity(<index>)
print((player.eye_angle_x, player.eye_angle_y))
We have not added eye_angle_z, because it's always 0 (I think).

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 57 guests