Describe the bug
When set the rotation of the localPlayer with conformPedRotation=true and the player is moving forwards. The rotation is not same after each frame. Some how it is set to another value.
This incorrect value is also visible for remote players, causing the remote players to see the localPlayer rapidly switching between 2 rotations when set with onClientRender on the localPlayer's end.
setElementRotation(localPlayer, 0, 0, newRotation, "default", true)
Steps to reproduce
This example puts the camera above the player, makes the ped walk non-stop and rotates the ped.
- It displays the last set rotation
- What it has become after the frame
- The difference between the two
local forceResetCameraRotation = false
local lastRotationSet = 0
addEventHandler("onClientPreRender", root, function()
local _, _, rotationAfterFrame = getElementRotation(localPlayer)
setPedControlState(localPlayer, "forwards", true)
if math.abs(rotationAfterFrame - lastRotationSet) > 2 then
dxDrawText(
"diff: " ..
tostring(math.floor(math.abs(rotationAfterFrame - lastRotationSet) + 0.5)) ..
" rotationAfterFrame: " ..
tostring(math.floor(rotationAfterFrame + 0.5)) ..
" lastRotationSet: " .. tostring(math.floor(lastRotationSet + 0.5)), 400,
400, 400,
600,
tocolor(255, 0, 0, 255),
2, "default",
"left", "center")
end
local newRotation = getTickCount() % 100000 / 100000 * 360
setElementRotation(localPlayer, 0, 0, newRotation, "default", true)
local _, _, rotationAfterSet = getElementRotation(localPlayer)
lastRotationSet = rotationAfterSet
if forceResetCameraRotation then
setCameraTarget(localPlayer)
else
local x, y, z = getElementPosition(localPlayer)
setCameraMatrix(x, y, z + 20, x, y, z)
end
end)
Version
MTA:SA Server v1.6-release-23826
Server version: 1.6.0-9.23826.0
Additional context
No response
Relevant log output
Security Policy
Describe the bug
When set the rotation of the localPlayer with conformPedRotation=true and the player is moving forwards. The rotation is not same after each frame. Some how it is set to another value.
This incorrect value is also visible for remote players, causing the remote players to see the localPlayer rapidly switching between 2 rotations when set with onClientRender on the localPlayer's end.
Steps to reproduce
This example puts the camera above the player, makes the ped walk non-stop and rotates the ped.
Version
MTA:SA Server v1.6-release-23826
Server version: 1.6.0-9.23826.0
Additional context
No response
Relevant log output
Security Policy