Page MenuHomeFeedback Tracker

Camera class register cars at a wrong position
Assigned, UrgentPublic

Description

When I try to use a free camera (using Camera class, not DayZPlayerCameraBase) to follow a car, the vehicle position seems to not be correctly register.

In this video you can see the car shakes and if you look carefully (trees and bushes at short distance) the landscape seems to not be very smooth too.

https://youtu.be/Qu_cD6jIAQM

Details

Severity
Feature
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General
Steps To Reproduce

Load the game with the code (or pbo) bellow, get in a car, press numpad5 to enter the free cam and press numpad5 again to get back to vanilla camera
In 4_World:

static MyCustomCamera myCustomCamera;

class MyCustomCamera extends Camera
{	
	void MyCustomCamera()
	{
		myCustomCamera = this;
		SetEventMask( EntityEvent.FRAME );
	}
	
	override void EOnFrame( IEntity other, float timeSlice )
	{	
		super.EOnFrame( other, timeSlice );
		
		vector playerPosition = GetGame().GetPlayer().GetPosition();
		SetPosition(playerPosition + "0 2 -5");		
		LookAt(playerPosition);
	}
}

In 5_Mission:

modded class MissionGameplay 
{	
	override void OnUpdate(float timeslice)
	{
		Input TestFreeCarCamInput = GetGame().GetInput();
		if ( TestFreeCarCamInput.LocalPress("TestFreeCarCam_ToggleCamera"))
		{
			if (!myCustomCamera)
			{
				GetGame().SelectSpectator(GetGame().GetPlayer().GetIdentity(), "MyCustomCamera", GetGame().GetPlayer().GetPosition() + "0 3 10");
			}
			else
			{
				if (myCustomCamera.IsActive())
				{
					myCustomCamera.SetActive(false);
					GetGame().SelectPlayer(GetGame().GetPlayer().GetIdentity(), GetGame().GetPlayer());
				}
				else
				{
					myCustomCamera.SetActive(true);
				}
			}
		}
		super.OnUpdate(timeslice);
	}
}

And here is the packed pbo used in the video in case you want to try it yourself :

Additional Information

I know this camera is not the main one designed to play but it is the only one "almost" working to achieve my project.
The best solution in my perspective would be to solve this bug https://feedback.bistudio.com/T169065, but in case this one is easier to solve I could settle for it and finally release my custom cam that provide really pleasant drive feeling for those liking 3rd cam driving.

Event Timeline

Liven created this task.Mar 24 2023, 12:27 PM
Geez changed the task status from New to Assigned.Mar 29 2023, 10:22 AM