View Issue Details

IDProjectCategoryView StatusLast Update
0007487Multi Theft Auto : San AndreasClientpublic2013-04-24 21:29
ReporterSam@keAssigned ToCazomino05 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Platformx86OSWindows 7 64-bitOS Version6.1 Built 7601
Product Version 
Target Version1.3.2Fixed in Version1.3.2 
Summary0007487: "getVehicleComponentPosition" returns only "0, 0, 0" for each component
Description

A call on getVehicleComponentPosition returns only "0, 0, 0" unaffected of used vehicle and vehicle component.

Tried with following compononts:

special_1
special_2
special_3
special_4
special_5
bonnet
boot
bumper_1
bumper_2
chassis
door_1
door_2
door_3
door_4
exhaust
windscreen

Steps To Reproduce

Enter any vehicle and try following lua snippet clientside:

function testVehicleComponent()
local vehicle = getPedOccupiedVehicle(getLocalPlayer());

if (vehicle) then
    local dx, dy, dz = getVehicleComponentPosition(lookAtVehicle, "door_1");
    outputChatBox(dx .. ", " .. dy .. ", " .. dz);
end

end
addEventHandler("onClientRender", getRootElement(), testVehicleComponent);

TagsNo tags attached.

Activities

Sam@ke

2013-01-31 21:25

viewer   ~~0018081

Correct snippet to reproduce:

function testVehicleComponent()
local vehicle = getPedOccupiedVehicle(getLocalPlayer());

if (vehicle) then
    local dx, dy, dz = getVehicleComponentPosition(vehicle , "door_1");
    outputChatBox(dx .. ", " .. dy .. ", " .. dz);
end

end
addEventHandler("onClientRender", getRootElement(), testVehicleComponent);

Jusonex

2013-01-31 23:32

administrator   ~~0018082

Last edited: 2013-02-03 15:13

Those component names aren't always these ones.
To get a list of all components, just call "getVehicleComponents".

addCommandHandler("getComponents",
function()
local vehicle = getPedOccupiedVehicle(localPlayer)
if not vehicle then return end
for name in pairs(getVehicleComponents(vehicle)) do
outputChatBox(name)
end
end
)

In most cases the front left door f.e. seems to be represented by "door_lf_dummy".

Sam@ke

2013-02-01 06:46

viewer   ~~0018083

Thanks, Jusonex.

I got component names from this document:

http://code.google.com/p/mtasa-blue/source/detail?r=4715

Seems to be outdated. I will try again with your solution and update/add them to wiki if its working.

Cazomino05

2013-02-03 15:16

reporter   ~~0018104

it changed since then, now it uses the component names in the model file which are dependent on which model you are editing though for the record it should be returning false if it didn't find the component rather than 0,0,0 :/

x86

2013-04-21 11:30

administrator   ~~0018373

Please check, Cazomino

Issue History

Date Modified Username Field Change