Skip to content

Conversation

@0Programmer
Copy link

This fix ensures that TaskTurnPedToFaceCoord is only run once, preserving ongoing or new animations.

Is it necessary to run this every few ticks? If so, I can adjust it.

…ew animations

Signed-off-by: 0Programmer <60280452+0Programmer@users.noreply.github.com>
@Maximus7474
Copy link

What use case does this satisfy ?
The main idea for having it run in the interval is to guarantee the player is always facing the other when searching him. This is purely an aesthetical feature because the other player can move around while being searched while still being in range.

@0Programmer
Copy link
Author

TaskTurnPedToFaceCoord cancels any animation started while the player is being searched. So if you want to play new animations during the search, they won’t work properly.

Possible ways around this:

  • Run it once to line up the ped, and only run it again if the heading is way off.
  • Add a convar for people who don’t really need the constant facing and want to handle it themselves.
  • Swap out TaskTurnPedToFaceCoord for GetHeadingFromVector_2d + SetEntityHeading using ped/target coords.
    local heading = GetHeadingFromVector_2d(
        pedCoords.x - playerCoords.x,
        pedCoords.y - playerCoords.y
    )
    SetEntityHeading(playerPed, heading)

I guess only a small group actually wants animations while searching/robbing, so maybe we just close the PR and let them tweak it themselves. Still, could be nice to mention in Common Issues, since it took me a while to figure out why animations kept getting canceled.

…prevent canceled animations

Replaced TaskTurnPedToFaceCoord with a manual heading calculation using GetHeadingFromVector_2d and SetEntityHeading.
- Prevents ongoing or new animations from being canceled when searching/robbing a player.
- Still ensures the ped faces the target at the start.
This avoids the side effect of TaskTurnPedToFaceCoord canceling animations while keeping the aesthetic alignment.

Signed-off-by: 0Programmer <60280452+0Programmer@users.noreply.github.com>
@0Programmer 0Programmer changed the title fix(client): run TaskTurnPedToFaceCoord once to preserve ongoing or new animations. fix(client): replace TaskTurnPedToFaceCoord with SetEntityHeading to prevent canceled animations Sep 15, 2025
@Maximus7474
Copy link

I'd say set heading is more appropriate solution to the issue described that wouldn't effect current servers.

@0Programmer
Copy link
Author

I thought the same, I’ve already pushed that change.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants