View Issue Details

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

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

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.

Activities

Necktrox

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.

Hyunsu2

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?

Necktrox

2015-02-16 20:28

developer   ~~0023011

http://i.imgur.com/rDFvBv4.png

setCameraTarget will only change the angles to the player.

Hyunsu2

2015-02-16 20:42

viewer   ~~0023013

Last edited: 2015-02-16 20:46

View 6 revisions

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

And the problem is similar to https://forum.mtasa.com/viewtopic.php?f=91&t=77302&hilit=aim+auto&start=45

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

Hyunsu2

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.

Necktrox

2015-02-16 21:34

developer   ~~0023015

Last edited: 2015-02-16 21:35

View 2 revisions

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

Hyunsu2

2015-02-18 03:51

viewer   ~~0023025

Last edited: 2015-02-18 03:51

View 2 revisions

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

ccw

2015-02-18 05:56

administrator   ~~0023026

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

Jusonex

2015-02-28 02:43

administrator   ~~0023055

Fixed in https://code.google.com/p/mtasa-blue/source/detail?r=7092

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