Page MenuHomeFeedback Tracker

SelectSpectator and UpdateSpectatorPosition not working as expected
Assigned, UrgentPublic


I tried to create a system, which would allow a player to spectate another player anywhere on the map. I tried to use it with the GetGame().SelectSpectator() method and I create my own Camera for it, which also spawns on the client at the correct position, but the network bubble is still at the old player position. I don't want to teleport the player near the other one for various reasons as a workaround. Also GetGame().UpdateSpectatorPosition() does not work here.

When I am near the other player, it all works fine. Just when I'm outside the network bubble, it stops working

Update: I also saw, that there is the DayZSpectator Camera class, which I changed for my LBSpectatorCamera to check if my Camera is the reason, but still the same behaviour.


Operating System
Windows 10 x64
Steps To Reproduce

Create a camera Class in 4_World like this:

class LBSpectatorCamera extends Camera
	static LBSpectatorCamera currentCamera;
	private float m_SendUpdateAcc = 0.0;

	void LBSpectatorCamera()
		SetEventMask( EntityEvent.FRAME );
		currentCamera = this;
		Print("Created LBSpectatorCamera");
	override void EOnFrame( IEntity other, float timeSlice )
		super.EOnFrame(other, timeSlice);
		if (!IsActive())
		if (m_SendUpdateAcc > 0.5)
			vector position = GetPosition();
			m_SendUpdateAcc = 0;
			Print("Sending Position Update: " + position);
		m_SendUpdateAcc = m_SendUpdateAcc + timeSlice;

And also mod the PlayerBase class like this

modded class PlayerBase {

	void NotifySpectateFinished() {
		GetGame().SelectPlayer(GetIdentity(), this);
		GetGame().RPCSingleParam(null, LBmaster_RPCs.SPECTATE_END, new Param1<bool>(true), true, GetIdentity());
	void NotifySpectateStart(PlayerBase target) {
		PlayerIdentity identity = GetIdentity();
		vector pos = target.GetPosition();
		GetGame().SelectPlayer(identity, null);
		GetGame().SelectSpectator(identity, "LBSpectatorCamera", pos);
		GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SendDelayedNotifySpectateStart, 200, false, target, identity);
	void SendDelayedNotifySpectateStart(PlayerBase target, PlayerIdentity identity) {
		GetGame().RPCSingleParam(target, LBmaster_RPCs.SPECTATE_START, new Param1<bool>(true), true, identity);

Then call the NotifySpectateStart method from the Server and the Camera will be created there for the player and it also works, but none of the objects around it will spawn and the LBmaster_RPCs.SPECTATE_START will not work, because the Target PlayerBase object has not been created. Also stopping work fine with NotifySpectateFinished. The Camera returns back to the original position and I can move around again

Event Timeline

LBmaster created this task.Tue, Mar 14, 8:42 PM
LBmaster updated the task description. (Show Details)Tue, Mar 14, 8:45 PM
LBmaster edited Steps To Reproduce. (Show Details)Tue, Mar 14, 9:03 PM
LBmaster updated the task description. (Show Details)Tue, Mar 14, 9:11 PM
Geez changed the task status from New to Assigned.Fri, Mar 17, 9:41 AM