View Issue Details

IDProjectCategoryView StatusLast Update
0008660Multi Theft Auto : San AndreasScriptingpublic2014-12-31 23:15
ReporterAlexTMjugadorAssigned Toqaisjp 
PrioritynormalSeveritytweakReproducibilityalways
Status resolvedResolutionfixed 
Product Version1.4 
Target Version1.4.1Fixed in Version1.4.1 
Summary0008660: Ped matrices are not affected by rotation if the element is a ped or vehicle
Description

The matrix of a ped returned by built-in getElementMatrix function always returns a matrix which doesn't take in account Z rotation of the ped. It can be fixed by using a Lua workaround but I think that it should be fixed at source level for consistency.

Steps To Reproduce

Create a ped.
/crun Element.getByType("ped")[1].rotation = Vector3(0, 0, 0)
/crun Matrix(Element.getByType("ped")[1]:getMatrix())
It will return the { 1.000, 0.000, 0.000 } { 0.000, 1.000, 0.000 } { 0.000, 0.000, 1.000 } { 0.000, 0.000, 0.000 } matrix, which is accurate.

/crun Element.getByType("ped")[1].rotation = Vector3(0, 0, 270)
/crun Matrix(Element.getByType("ped")[1]:getMatrix())
It will also the { 1.000, 0.000, 0.000 } { 0.000, 1.000, 0.000 } { 0.000, 0.000, 1.000 } { 0.000, 0.000, 0.000 } matrix, which is not accurate.

Additional Information

This bug doesn't happen with players. I haven't tested other element types besides players, peds and vehicles.

TagsNo tags attached.

Activities

AlexTMjugador

2014-11-27 18:56

viewer   ~~0022609

Last edited: 2014-11-27 19:01

View 4 revisions

Okay, I tested more properly and it seems that this issue only occurs when recreating a matrix using Matrix() method, but in any element. However, this issue still makes it more difficult to reliably use matrices with procedural functions. From my point of view, this code should return a proper matrix from the matrix array, to made things simpler:

/crun Matrix(getElementMatrix(getElementsByType("ped")[1]))

Because right now we have to do this to get a proper matrix, which is far more complicated:

/crun Matrix(Vector3(getElementPosition(getElementsByType("ped")[1])), Vector3(getElementRotation(getElementsByType("ped")[1])))

ccw

2014-11-27 19:38

administrator   ~~0022610

Similar problem with Vector3 as well:

crun Vector3(Vector3(1,2,3))
Command results: vector3: { x = 0.000, y = 0.000, z = 0.000 } [userdata]

qaisjp

2014-11-30 14:18

administrator   ~~0022621

Last edited: 2014-12-31 22:01

View 2 revisions

@ccw's post, I noticed yesterday that:
Vector3(nil, 1, 1) doesn't error out. I'll try to investigate this - it seems like a simple argStream tweak.

Anyway: http://qs.lc/vnh5i

qaisjp

2014-12-31 23:13

administrator   ~~0022760

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

Issue History

Date Modified Username Field Change