View Issue Details

IDProjectCategoryView StatusLast Update
0008767Multi Theft Auto : San AndreasClientpublic2015-02-28 02:43
ReporterHyunsu2 Assigned ToJusonex  
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Target Version1.5Fixed in Version1.5 
Summary0008767: setCameraTarget(x,y,z) has incorrect calculation.

local cx,cy,cz,lx,ly,lz = getCameraMatrix();

this script should make camera's position of player be no change.
because the function has just changing only position of camera's lookat with fixed position of camera.

but the script makes position of camera.(also lookat position).
Is it not expected result?

(sorry for my english)

TagsNo tags attached.



2015-02-16 19:55

developer   ~~0023009

That function only changes the rotation based on the player into the direction (position). You should use setCameraMatrix for your desired effect.


2015-02-16 20:18

viewer   ~~0023010

Necktrox // i want to make rebound of gun system(up crosshair when shot).
So i should know detaily about setCameraTarget.
but wiki has no detail explain.
where is the explain about "the rotation based on the player"?
And what is the based position?
wiki just says "The target position that you want the local camera to look at".
can you help me make the rebound system?


2015-02-16 20:28

developer   ~~0023011

setCameraTarget will only change the angles to the player.


2015-02-16 20:42

viewer   ~~0023013

Last edited: 2015-02-16 20:46

The angle that function calculates is incorrect.
can you test it to know my problem?

And the problem is similar to

when camera is higher or lower, calculated camera's lookat position go to middle.


2015-02-16 20:56

viewer   ~~0023014

there is no problem about left, right.
but up, down result is incorrect.
mta team, please test it.


2015-02-16 21:34

developer   ~~0023015

Last edited: 2015-02-16 21:35

crun b = localPlayer.position; a = getCamera().position; c = b - a
crun setCameraTarget(b.x + c.x, b.y + c.y, b.z + c.z)

Vertical angle is still wrong


2015-02-18 03:51

viewer   ~~0023025

Last edited: 2015-02-18 03:51

Then, how should i do to calculate correct vertical angle?


2015-02-18 05:56

administrator   ~~0023026

Jusonex might know more about it, as he did the code for setCameraTarget


2015-02-28 02:43

administrator   ~~0023055

Fixed in

The problem was that setCameraTarget was based on the player position instead of the camera position before. This did not significantly influence the calculated angles when focusing a specific point, but caused the camera to look backwards when using the lookAt vector.

Issue History

Date Modified Username Field Change