View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004370 | Multi Theft Auto : San Andreas | Server | public | 2009-05-26 15:41 | 2009-07-14 18:08 |
Reporter | karloz | Assigned To | Jax | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | |||||
Target Version | Fixed in Version | 1.0 | |||
Summary | 0004370: getObjectRotation() returns acumulated values for attached objects | ||||
Description | When you call getObjectRotation() on an object that is actually attached to other object, the function returns attachment offset but accumulate them in every call. in the included code i create a car and an object attached to it with initial rotation rx=1,ry=1,rz=1 first time i call getObjectRotation() = 1,1,1 and so on.. object rotation doesnt changes | ||||
Additional Information | -- Example: test.lua -- -- Offsets function createArmedcar(player, cmd)
end function rotateIt(player, cmd, addZ) function checkOffsets(player, cmd) addCommandHandler("bobcat", createArmedcar) | ||||
Tags | No tags attached. | ||||
parent of | 0004405 | closed | Source patches | Server Element Rotations |
|
This is actually not the real bug, the reason it increments is that the code above was commented out, Thus causing the function to increment each time. The code above was supposed to reset the member variable storing the rotations with the real rotation of the object itself and therefore stop it incrementing. to sum up what I have just posted: Edit: |
|
I see, in CObject.cpp
but the real fix is at CElement Actually CElement doesnt have Get/SetRotation functions, so you cant know if the function exists in m_pAttachedTo, thats why that code is commented out. As a fast fix [Get/Set]Roration virtual funtions should be added to CElement. Current CElement::[Get/Set]Position doesnt check if element is attached, and most of attachable Elements need this. Non attachable Elements will evaluate if(m_pAttachedTo) => false CElement.h
CElement.cpp const CVector& CElement::GetPosition ( void )
} void CElement::SetPosition ( const CVector& vecPosition )
} const CVector& CElement::GetRotation ( void )
} void CElement::SetRotation ( const CVector& vecRotation )
} this should work Another related issue is this, in CPed (and derived class CPlayer)
If you attach something to a ped, the above GetRotation would fail void CPed::SetRotation ( float fRotation )
} m_vecRotation is not initialized in CPed constructor it should be initialized to 0 0 0 Linker should choose the correct GetRotation here: When a ped is attached to an Element it rotates in X Y axes correctly but not |
|
"Actually CElement doesnt have Get/SetRotation functions, so you cant know if the function exists in m_pAttachedTo, thats why that code is commented out." Hence why it isn't fixed yet if it was a simple job of un-commenting that line. |