Gaimo Posted January 22, 2021 Share Posted January 22, 2021 addEventHandler("onClientVehicleStartExit", getRootElement(), function() local x,y,z = getVehicleComponentRotation(source, "wheel_lf_dummy") local x1,y1,z1 = getVehicleComponentRotation(source, "wheel_rf_dummy") outputChatBox(x) -- work print(setVehicleComponentRotation(source, "wheel_lf_dummy", x, y, z) ) -- true setVehicleComponentRotation(source, "wheel_rf_dummy", x1, y1, z1) end) The script has no error. Returns the rotation of the wheel, returns true in the setVehicleComponentRotation but the wheel is not rotated. What is happening? Result I'm looking for: Spoiler Link to comment
Moderators IIYAMA Posted January 22, 2021 Moderators Share Posted January 22, 2021 (edited) 1 hour ago, Gaimo said: What is happening? I don't think component rotations are based on player input. They are probably based on values that are set by setVehicleComponentRotation. setVehicleComponentRotation > changes the value of: getVehicleComponentRotation If the value is set by setVehicleComponentRotation that changes the rotation, then yes it might be a scripting issue. But also in that case, the wheel will be locked in that position and there is no need to set the same value. If not, then this will maybe help you to get the correct value: https://wiki.multitheftauto.com/wiki/GetPedAnalogControlState If the value is correct: setVehicleComponentRotation( defaultRot + maxRotationOffset * constrolState) --[[ When entering the vehicle ]] -- reset this to default -- and set the analalogControlState again. These are my recommendations, keep in mind that there is no guaranty that those will work, since I haven't build this myself yet. Edited January 22, 2021 by IIYAMA Link to comment
SpecT Posted January 22, 2021 Share Posted January 22, 2021 (edited) I just did some testing and the weird thing is it kinda works kinda not. It gets the correct rotation and when you leave the vehicle it resets the wheels to their default rotation but when you start entering back in the vehicle and AFTER the ped closes the door it sets the old rotation (turned) for some miliseconds and then it resets the rotation to default. Dunno if this helps somehow tho. Edited January 22, 2021 by SpecT 1 Link to comment
Gaimo Posted January 22, 2021 Author Share Posted January 22, 2021 2 minutes ago, SpecT said: Eu só fiz alguns testes e o estranho é que meio que funciona meio que não. Ele recebe a rotação correta e quando você sai do veículo ele redefine as rodas para a sua rotação padrão, mas quando você começa a entrar de volta no veículo e depois que o ped fecha a porta ele define a rotação antiga (virada) para alguns milisegundos e, em seguida, ele redefine a rotação para o padrão. Não sei se isso ajuda de alguma forma. Really, I will try to do a test with a settimer, and return. Link to comment
SpecT Posted January 22, 2021 Share Posted January 22, 2021 (edited) This is some sort of GTA:SA limitation. There are mods (for GTA:SA) that can remove this limitation but without mods I don't think it's possible in MTA. You can create a ped and warp it in the vehicle and use setPedAnalogControlState to turn to the last known direction by the player BUT warpPedIntoVehicle only works with client created peds and vehicles (those are not seen by the other players). Sooo it seems impossible. You could write this in here as an issue but I don't know if they will take care about it. Edited January 22, 2021 by SpecT Link to comment
JustinMTA Posted January 22, 2021 Share Posted January 22, 2021 (edited) Edit: I thought you were talking about the actual steering wheel I misunderstood lmao.. Edited January 22, 2021 by JustinMTA Link to comment
Gaimo Posted January 22, 2021 Author Share Posted January 22, 2021 49 minutes ago, SpecT said: Esta é uma espécie de limitação GTA:SA. Existem mods (para GTA:SA) que podem remover essa limitação, mas sem mods eu não acho que seja possível no MTA. You can create a ped and warp it in the vehicle and use setPedAnalogControlState to turn to the last known direction by the player BUT warpPedIntoVehicle only works with client created peds and vehicles (those are not seen by the other players). Sooo it seems impossible. Você poderia escrever isso aqui como um problema, mas eu não sei se eles vão se importar com isso. I think the easiest thing would be to add a ped with alpha 0 and remove it when the player enters. 9 minutes ago, JustinMTA said: Eu poderia tentar separar o volante como um componente separado, permitindo que você faça engenharia reversa de todo o processo do zero.. Eu poderia até adicionar uma roda 3D para você. Adicione-me em Discord ou Telegram, o nome está na minha assinatura. I don't know if I would know how to do this reverse engineering. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now