Jump to content

Avoid shake camera while killingPed


Overkillz

Recommended Posts

Posted (edited)

Hello dear community, Im getting mad with the annoying shake camera when you kill a ped (In this case the local player - source at serverside.)

Well, Im trying to use setCameraMatrix after killing a player due to the player leave the room. I have seen some months ago that there was a function for it but Im not even sure if it is setCameraShakeLevel

Ways I have tried several ways (More than the following ones)

--# Try #1 CLIENT Side
setCameraShakeLevel(0)
setCameraMatrix(488.32220458984,-1607.4827880859,37.201072692871,399.98428344727,-1560.7738037109,41.033145904541)

--# Try #2 Server Side
setCameraMatrix(source,488.32220458984,-1607.4827880859,37.201072692871,399.98428344727,-1560.7738037109,41.033145904541)
setElementHealth(source,0)

--# Try #3
setElementHealth(source,0)
setCameraMatrix(source,488.32220458984,-1607.4827880859,37.201072692871,399.98428344727,-1560.7738037109,41.033145904541)

--# Try #4
local cam = getCamera()
setElementPosition( cam, 0,0,0 ) --Just for testing but it doesn't work too

Thanks for reading. Best regards.

Edited by Overkillz
Posted
47 minutes ago, Overkillz said:

Hello dear community, Im getting mad with the annoying shake camera when you kill a ped (In this case the local player - source at serverside.)

Well, Im trying to use setCameraMatrix after killing a player due to the player leave the room. I have seen some months ago that there was a function for it but Im not even sure if it is setCameraShakeLevel

Ways I have tried several ways (More than the following ones)


--# Try #1 CLIENT Side
setCameraShakeLevel(0)
setCameraMatrix(488.32220458984,-1607.4827880859,37.201072692871,399.98428344727,-1560.7738037109,41.033145904541)

--# Try #2 Server Side
setCameraMatrix(source,488.32220458984,-1607.4827880859,37.201072692871,399.98428344727,-1560.7738037109,41.033145904541)
setElementHealth(source,0)

--# Try #3
setElementHealth(source,0)
setCameraMatrix(source,488.32220458984,-1607.4827880859,37.201072692871,399.98428344727,-1560.7738037109,41.033145904541)

--# Try #4
local cam = getCamera()
setElementPosition( cam, 0,0,0 ) --Just for testing but it doesn't work too

--# Try #5
setElementPosition(localPlayer,0,0,10)
setElementFrozen(localPlayer,true)
setCameraMatrix(source,488.32220458984,-1607.4827880859,37.201072692871,399.98428344727,-1560.7738037109,41.033145904541)

Thanks for reading. Best regards.

 

Posted

This should fix your problem, but you will need to reset the camera target to localPlayer when you spawn again.

addEventHandler("onClientPreRender", root,
	function()
		if isPedDead(localPlayer) then
			setCameraMatrix(getCameraMatrix());
		end
	end
	);

 

Posted

Maybe i misunderstood your problem, your problem is that you want to make the camera stay where the player died or not? If is it then the example i gave you above should work

  • Moderators
Posted

I have heard of this issue, but never ever had encounter it while killing a ped.

How to reproduce this issue?

And are you sure this isn't caused by a resource or your version of GTA?

Posted

@TRtam

Let me explain you my issue slowly.

I have different Room Game Modes(some dx buttons) Behind the dxbuttons there is a cameraMatrix . When a player joins to one, the player spawn and automatically is warped into vehicle, so the camera goes to cameraTarget(localPlayer)

If the players wants to leave the Room Game Mode selected previously, I can restore the dxbuttons and everything, EXCEPT  the cameraMatrix due to I kill the ped before he left the room, so the camera starts to shake instead setting the cameraMatrix

I have tried several ways, avoiding killing the ped, spawning the ped again after killing it and setting it a x position and frezeing it but nothing works.

 

@IIYAMA

What do you mean with version of GTA ?.

Here you have a video of it

 

Well, I've fixed the issue practically by implementing everything at serverside.

setElementHealth(source,0)
spawnPlayer ( source, 0, 0, 5, 90, 0,0, 30 )
setElementFrozen(source,true)
setCameraTarget(source,source)
setCameraMatrix(source,x,y,z,t,r,s)

 

  • Moderators
Posted
10 hours ago, Overkillz said:

Well, I've fixed the issue practically by implementing everything at serverside. 

Shouldn't "onClientPreRender" + setCameraMatrix fix the job?

The wasted camera effect is a delayed effect. It occurs not imidiatly, but after a few frames. Also I do not know if the effect is just one frame or multiple.

 

Another possible way could be attaching the camera to another element. But no guarantees.

 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...