Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add animation related functions #3734

Merged

Conversation

TracerDS
Copy link
Contributor

Resolves #3731

@TracerDS TracerDS marked this pull request as ready for review September 18, 2024 11:07
@Fernando-A-Rocha
Copy link
Contributor

Nice u work fast!

What about these functions:

  • getPedAnimationLength(string block, string anim)
  • isPedDoingAnimation(ped/player ped, string anim)
  • getAnimationsInBlock(string block)

@TracerDS
Copy link
Contributor Author

TracerDS commented Sep 18, 2024

Nice u work fast!

What about these functions:

  • getPedAnimationLength(string block, string anim)
  • isPedDoingAnimation(ped/player ped, string anim)
  • getAnimationsInBlock(string block)

I will add getPedAnimationLength in a sec (it will take current animation though for simplicity)

isPedDoingAnimation would just be a shortcut for getPedAnimation

I dont see a point in getAnimationsInBlock function.

@Fernando-A-Rocha
Copy link
Contributor

Ah yes forgive me I forgot about getPedAnimation

getAnimationsinBlock could be an useful getter. I can imagine it being used after loading a custom IFP with engineLoadIFP to check what animations are contained inside the custom block.

@ChemicalCreations
Copy link

Nice u work fast!
What about these functions:

  • getPedAnimationLength(string block, string anim)
  • isPedDoingAnimation(ped/player ped, string anim)
  • getAnimationsInBlock(string block)

I will add getPedAnimationLength in a sec (it will take current animation though for simplicity)

isPedDoingAnimation would just be a shortcut for getPedAnimation

I dont see a point in getAnimationsInBlock function.

Well, let me clear up some things, getPedAnimation would function closer to setPedAnimationSpeed(ped, 1) actually. The true purpose is not to get the animation set by setPedAnimation but to get any animation that is currently being done by the ped, specifically natural animations that are used during gameplay.
Saying this now, I realize that most probably didn't even know that set ped animation speed/progress doesn't only work on scripted animations. XD Like I said, personal research.
getAnimationsInBlock would be useful for detecting animations added in .IFPs as one usecase. Think of the potential to have walking animations auto imported or auto add anims to the freeroam resource.

As for getPedAnimationLength, the intention was to have some millisecond reference to go along with setAnimationProgress, as this is relative to the animation length, would be nice if this could be pulled from the "(block, anim)" instead of the "(ped, anim)"

@TracerDS
Copy link
Contributor Author

As for getPedAnimationLength, the intention was to have some millisecond reference to go along with setAnimationProgress, as this is relative to the animation length, would be nice if this could be pulled from the "(block, anim)" instead of the "(ped, anim)"

getPedAnimationProgress isnt relative so getting its length wont be either

@ChemicalCreations
Copy link

getPedAnimationProgress isnt relative so getting its length wont be either

But setPedAnimationProgress is relative (0-1 irrespective of animation length in ms), so I think getPedAnimationProgress should do the same, and following this logic, getPedAnimationLength would be the function to fetch the progress relative to time. IE: currAnimRuntime = getPedAnimationProgress(ped, anim)*getAnimationLength(block, anim)

I suppose getPedAnimationLength(ped, anim) could also be a thing and would more closely resemble this comment below.

I will add getPedAnimationLength in a sec (it will take current animation though for simplicity)

@TracerDS
Copy link
Contributor Author

Ready

@Dutchman101
Copy link
Member

This has had multiple code review passes, and all feedback is addressed. Merging

@Dutchman101 Dutchman101 merged commit aa0591c into multitheftauto:master Oct 15, 2024
6 checks passed
@TracerDS TracerDS deleted the 180924_Add_animation_functions branch October 15, 2024 05:55
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.

New functions for ped animations (getPedAnimationLength, getPedAnimationSpeed, etc)
6 participants