EnablePlayerCameraTarget
#1

Hey guys.

I've wanted to ask you something about EnablePlayerCameraTarget function. In my server I use player's camera to point things and use them, like here:


I've been using GetPlayerCameraFrontVector and GetPlayerCameraPos to see if player is looking at objects or NPCs. Should I continue using it, or should I EnablePlayerCameraTarget and use GetPlayerCameraTarget?
Reply
#2

You can use: https://sampwiki.blast.hk/wiki/GetPlayerCameraTargetObject
and I'm not sure if NPCs are targeted as "players": https://sampwiki.blast.hk/wiki/GetPlayerCameraTargetPlayer
If it does, a simply check (IsPlayerNPC) would be a good way to do this.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You can use: https://sampwiki.blast.hk/wiki/GetPlayerCameraTargetObject
and I'm not sure if NPCs are targeted as "players": https://sampwiki.blast.hk/wiki/GetPlayerCameraTargetPlayer
If it does, a simply check (IsPlayerNPC) would be a good way to do this.
I've replaced NPCs with Actors, so I can use GetPlayerCameraTargetActor, but I want to know if GetPlayerCameraTarget functions will improve performance using instead of GetPlayerCameraPos and Vector, because Wiki says, that EnablePlayerCameraTarget will use a lot of bandwidth.
Reply
#4

Quote:
Originally Posted by Kalcor
The camera targeting functions added in 0.3.7-RC1 will be disabled by default as it may use bandwidth on servers when it's not needed.
that's a downside but as I'm not aware of the answer you're looking for (never used it), let's wait for another member to reply.
Reply
#5

Enabling camera targeting will use more server networking bandwidth, but using PAWN functions will slow your server down. I'd go for bandwidth. Shouldn't matter unless you're on a 56 kb/s host..
Reply
#6

Quote:
Originally Posted by MP2
Посмотреть сообщение
Enabling camera targeting will use more server networking bandwidth, but using PAWN functions will slow your server down. I'd go for bandwidth. Shouldn't matter unless you're on a 56 kb/s host..
I'm planning to buy 80-100mbps server, is that ok?
Reply
#7

I'm sure the difference would be minimal. However, Kye must have included the function to disable it to save bandwidth for a reason. I guess with hundreds of players it could have a small effect, but probably still not much.
Reply
#8

In a couple weeks you will be able to use ColAndreas to do this, it looks like to me that the function only checks against objects and not player objects obviously a system like this is going to require using the streamer. There are other options as well to check if you are looking at an object.

There is other decisions you need to make as well such has how you actually check for objects efficiently. What I would do is create a dynamic area for each object then use an iterator to store the areaids the player is in and the type of area in a variable. From there it is a matter of looping through your iterator to check if the player is looking at any one object(s).
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)