Skip to content

Conversation

@manzarek123
Copy link
Contributor

Goal of this PR

FiveM implementation of #3667

How is this PR achieving the goal

The changes introduced in this PR focus on improving the mathematical computations within the Unproject function, which is responsible for converting screen-space coordinates to world-space coordinates.

This PR applies to the following area(s)

FiveM

Successfully tested on

Game builds: FiveM 3258
Platforms: Windows

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

Improves accuracy of the GetWorldCoordFromScreenCoord native for FiveM.

@github-actions github-actions bot added the invalid Requires changes before it's considered valid and can be (re)triaged label Oct 21, 2025
@prikolium-cfx
Copy link
Collaborator

@Identity-labs Could you please check this implementation as it's port of your RedM PR?

@Identity-labs
Copy link
Contributor

I just tested it without any change on master, it's not shaking like it was on RedM
And with the patch, it's same result for me.
So i dont know if it's relevant to merge it

Tested with this snippet

CreateThread(function()
  while true do
    Wait(0)
    SetMouseCursorThisFrame()
    local ped = PlayerPedId()
    local pos = GetEntityCoords(ped)

    local screenX = GetDisabledControlNormal(0, 239)
    local screenY = GetDisabledControlNormal(0, 240)

    local world, normal = GetWorldCoordFromScreenCoord(screenX, screenY)
    local targetPos = pos + normal * 10.0
    DrawLine(pos.x, pos.y, pos.z, targetPos.x, targetPos.y, targetPos.z, 255, 255, 255, 255)
  end
end)

@manzarek123 can you provide a record of the issue ? and may be repro code ?

@manzarek123
Copy link
Contributor Author

For me your repro is enough to validate that this is better
try with a camera closer to your character or in first person to accentuate the problem

I think it would be relevant then :)

shaking.mp4
noshaking.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Requires changes before it's considered valid and can be (re)triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants