Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OOP: "Effect": Cannot apply various world properties via member properties #906

Open
fedorms opened this issue Apr 30, 2019 · 0 comments
Open
Labels
bug Something isn't working

Comments

@fedorms
Copy link

fedorms commented Apr 30, 2019

Describe the bug
I am unable to set properties of an "Effect" object through its member variables, however I can by using the class functions.

To reproduce:
Assigning a new matrix will not update the object's physical position or .position property, but will change the matrix property.

local fx = Effect.create("petrolcan", Vector3(0,0,0))

addEventHandler("onClientPreRender", root, function ()
        local bone1 = localPlayer:getBonePosition(1)
        fx.matrix=Matrix(bone1,Vector3(0,90,-localPlayer.rotation.z+90))
        outputDebugString("Player z: " .. localPlayer.position.z .. " Effect z via .position: " .. fx.position.z .. " Effect z via .matrix property: " .. fx.matrix.position.z )
    end
)

Result:

image

Result:

image

Setting the position member works, but does not update the object position. The matrix is not updated.

local fx = Effect.create("petrolcan", Vector3(0,0,0))

addEventHandler("onClientPreRender", root, function ()
        local bone1 = localPlayer:getBonePosition(1)
        fx.position = bone1
        fx.rotation = Vector3(0,90,-localPlayer.rotation.z+90)
        outputDebugString("Player z: " .. localPlayer.position.z .. " Effect z via .position: " .. fx.position.z .. " Effect z via .matrix property: " .. fx.matrix.position.z )
    end
)

Result:

image

Expected behaviour:
Setting the position and rotation using the class functions works as intended. This behavior ought to work using the .matrix and .position members as it does with most objects.

local fx = Effect.create("petrolcan", Vector3(0,0,0))

addEventHandler("onClientPreRender", root, function ()
        local bone1 = localPlayer:getBonePosition(1)
        fx:setPosition(bone1)
        fx:setRotation(Vector3(0,90,-localPlayer.rotation.z+90))
        outputDebugString("Player z: " .. localPlayer.position.z .. " Effect z via .position: " .. fx.position.z .. " Effect z via .matrix property: " .. fx.matrix.position.z )
    end
)

image

Version:
Tested on Multi Theft Auto v1.5.6-release-16705, tester on Discord ran all 3 scripts successfully using Multi Theft Auto v1.5.6-release-16614.

@fedorms fedorms added the bug Something isn't working label Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant