SA-MP Forums Archive
Moving Camera - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Moving Camera (/showthread.php?tid=159559)



Moving Camera - armyoftwo - 13.07.2010

Код:
SetTimerEx("MovingCamera", 10, true, "%i", playerid);
i set camera to move every 10 milliseconds

Код:
public MovingCamera(playerid)
{
	new Float:X, Float:Y, Float:Z = GetPlayerCameraPos(playerid, X, Y, Z);
	SetPlayerCameraPos(playerid, X+2, Y+2, Z);
	SetPlayerCameraLookAt(playerid, X+2, Y+2, Z);
	return 1;
}
the function for moving

the problem is that it moves the camera like in 1 sec not in 10 milliseconds!


Re: Moving Camera - Carlton - 13.07.2010

Joining this question, I used to have a problem with this too.


Re: Moving Camera - Mauzen - 13.07.2010

This probably is a server/samp problem. The timerinterval is not 1/1000 sec accurate, also on fast systems, it is +-100-200ms. Creating new variables and getting and setting all the camerastuff also eats some processtime, which create additional delays, so an 10ms update timer is just not possible.

You could try to add it to OnPlayerUpdate, it is called as fast as possible then, but may cause lags.


Re: Moving Camera - RyDeR` - 13.07.2010

I also made a moving camera script and it moves very smooth at 20 ms.
I also used PVars.


Re: Moving Camera - armyoftwo - 14.07.2010

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
I also made a moving camera script and it moves very smooth at 20 ms.
I also used PVars.
can you tell me how?

Putting under onplayerupdate is the same!


Re: Moving Camera - armyoftwo - 14.08.2010

Still anyone?


Re: Moving Camera - armyoftwo - 24.08.2010

**bump** anyone?


Re: Moving Camera - Hiddos - 24.08.2010

Possibly it might be because you're setting the camera look at thingy to the same pos at the camera's, even though it sounds unlikely.

What about a camera of 33ms? Still 30 movements a second which is equal to 33 FPS (Almost)


Re: Moving Camera - armyoftwo - 24.08.2010

Still the same, anyone?
EDIT: It moves faster if i hold mouse buttons


Re: Moving Camera - CaHbKo - 24.08.2010

You could apply some looping animation to the player (/box), and set moving the camera on their OnPlayerUpdate. Player updates much more often when in a looping animation. If it's too fast, make a counter and set it, for example, each 2 updates.