Get origin in player's viewcone?
I've made a test map, added one env_sprite entity and named it "sprite_test". This plugin is supposed to spam a chat message to each player only if the entity('s origin) is inside the players' 3D viewcone. However, it does not.
PHP Code:
I've also tried replacing find_ent_by_target with find_ent_by_class with "env_sprite" as the second parameter, without any luck. |
Re: Get origin in player's viewcone?
can you try:
Code:
is_visible( playerID, entityID ) |
Re: Get origin in player's viewcone?
Quote:
|
Re: Get origin in player's viewcone?
Did you confirm the entity is spawned in a place that can be in your player viewcone? Are you really searching for the entity in plugin_init()? Maybe it doesn't exist yet.
The function works, aim at a player and say "test" PHP Code:
|
Re: Get origin in player's viewcone?
Actually, I've been playing around my code a bit and tried different methods. The entity is there. I'm getting the logs I want. For example, in my testmap, the sprite entity has an id of 38, as seen in logs.
PHP Code:
Yes, I can definitely see the entity. It's in the middle of the room, basically. |
Re: Get origin in player's viewcone?
Do a server print of the entity's origin after this...classic debugging.
pev(TestSprite, pev_origin, fTestOrigin); |
Re: Get origin in player's viewcone?
Huh. Weird. The origin is kinda wrong. The entity is clearly placed at one origin while the method with the entity's origin returns an origin a bit further from the entity.
|
Re: Get origin in player's viewcone?
Blefk!
Turns out, the PlayerThink function did not work. Chose a different method of checking instead to show the output. Both is_visible and is_in_viewcone work. |
| All times are GMT -4. The time now is 02:57. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.