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

[WIP] Animation system #1440

Open
wants to merge 405 commits into
base: develop
Choose a base branch
from
Open

[WIP] Animation system #1440

wants to merge 405 commits into from

Conversation

stilnat
Copy link
Contributor

@stilnat stilnat commented Mar 25, 2024

Summary

This PR intends to implement the following :

  • Switching between positions : walking, running, proned, crouched, sitted, and ragdolled. When feet are too hurt, the human
    goes into ragdoll and then crawl. Player can cycle between the positions.
  • Grabbing : Allows grabbing some body parts (feet and hand currently but easy to add more), as well as furniture (unbolted girders)
  • Holds : Different holds are implemented : toolbox, gun, small item, under arm as well as their thrown variant.
  • Animations : Different procedural animations are implemented : Punching, swinging items, picking and placing, interacting
    with tools and interacting with hands on stuff like switches.
  • Intent can be switched through UI and the interaction changes

It comes with this WIP design doc : https://docs.google.com/document/d/11wd4HigSu5Tn3ioCaafTzBFh7I_xzBOF/edit

PR checklist

  • The game builds properly without errors.
  • No unrelated changes are present.
  • No "trash" files are committed.
  • Relevant code is documented.
  • Update the related GitBook document, or create a new one if needed.

Pictures/Videos)

Testing

What you can do :

  • press C to cycle through positions.
  • Try clicking on items to pick them up, try with different items,
  • try clicking on ragdolled body to drag it
  • Try clicking on the SMES or the jukebox for the interaction animation
  • press R to go in throw mode when holding an item in hand
  • try switching intent and punch yourself or another client by clicking
  • try switching intent while in throw mode with the tool box or a wrench
  • try clicking a chair to sit, and clicking again to get up.

Changes

  • Holding items no longer work with parenting it to the hold transform. Its now using the animation rigging system. In particular, this change means it will be necessary to change all item attachment sadly.
  • I might have overloaded a bit the hand script now, as it's now handling keeping references to different IK targets.
  • I used a lot DOTween to implement animations, procedural animations are mostly implemented by moving the IK targets along some path created with DOTween.
  • Some small changes to the interaction system, mostly simplifying it a bit.
  • Updated unity to latest 2021 LTS

Really in game

  • Add pickup as IK animation and integrate to the interaction system
  • Add place as IK animation and integrate to the interaction system
  • Add throw as IK animation and integrate to the interaction system
  • Add Drop as an interaction, simply dropping item in hand
  • Update hold correctly as things are moved in and out of hand.
  • Add gun aiming
  • Add hand poses for different holding types.
  • Add Grabbing
  • Add hold pose (animation override) for harm intent with gun (torso in diagonal)
  • Add tool animations when interacting
  • Add crouching idle, crouching walk, crouching run animations
  • Add Ragdoll
  • Add sit as an interaction
  • Add toggle and change music as delayed interaction to press
  • When sitting, only rotate torso and allow interactions in front
  • After ragdolled, can't get up if feet are too hurt

To improve

  • Grabbing should behave differently for body parts and for heavy objects. For heavy objects, the player should grab at a given location without moving the item. For bodyparts, the bodypart should be moved a bit. This is to ensure some visual consistency in dragging stuff. Might be implemented simply with a bool in grabbable script.
  • Interacting at transform position (screwdriving for instance) sometimes look like shit, it'd be better to have some interaction points on the model instead when available.
  • Interacting with tools when canceling should get back human to normal position immediatly.
  • When aiming to throw or with a gun, proper strafing should occur.
  • Create an editor tool to help edit holds on items.

Bugs

Major bugs

  • On client, sometimes picking up does not register putting in container (unwanted collisions might be related to this)
  • Can't drop on client, only place.
  • On Client, items keep their collider active when in hand, resulting in unwanted collisions.
  • Clothes get smaller when taken in out of clothes slots, on client items become bigger.
  • On Client, things are on the ground when they should be in hand upon spawning.
  • Throw look like shit on client
  • Throw doesn't throw at the right place
  • on ragdoll human goes back to origin
  • Grabbing does nothing. I believe this has to do with client ownership. When grabbing, the grabber should become the owner of the ragdoll, but also rigidbodies and colliders should be set properly.
  • Break take first interaction
  • no syncing position and animations not syncing

Minor bugs

  • Switching hand through pickup is messing with hold position
  • On host when picking and dropping quickly enough, item stay parented on human
  • Cancel pickup on client doesn't get human back in normal position (still reaching)
  • Placing is a bit capricious
  • Dropping on client causes a little glitch on position of dropped items
  • Client doesn't drop using UI
  • When crouched and interacting with a tool, when trying to get up, the tool stays in its crouched position

Story goal

Player has a toolbox in hand, he places it on a table (animated), he then goes to the jukebox and start playing music, he then goes back to toolbox and open it (animated), take from it a wrench and fix the girders. He then throws the wrench on the jukebox, and the toolbox above a locker, he then take the m4 and shoot on the toolbox.

Related issues/PRs

Future work

  • Not related but I believe we can safely remove the container non custom editor and "automatic container setup" field. It should never be non "automatic"
  • When throwing, ideally the item should follow the hand before the throw. This is kinda hard to do properly, to make it work on client.
  • Currently, holds are implemented fully through IK, it allows potentially having a unique way to hold any item, and it's easy to setup, however, sometimes it looks a bit bland. For instance, I like the old way of holding small items. It should be possible to have the best of both worlds (IK placement and hold transform attachment). It would be especially useful for the prone position, where a semi static hold would not look great.
  • For better looking hold poses, another thing that could be added to the IK poses are transform for the hint of the two bone ik constraint.
  • The way interaction sources are fetched is broken : I want my hand to be a source for the hit interaction, with whatever item its holding, but I currently can't because items in hands are considered the only source. Need to fix that.
  • Need to move some logic from the ragdoll script to the movement controller. For instance, after a ragdoll, maybe the player can't get up if its feet are not working anymore. The ragdoll script should not handle that.

@cosmiccoincidence cosmiccoincidence added the Movement Tasks related to character movement. label Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Movement Tasks related to character movement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants