There where several key challenges when I set out to animating the project.
1) I was using a full body avatar, most VR projects start as one hand mesh by default in unreal that is then duplicated for the left hand meaning only one animation can serve both hands
2) I needed to have an idea of what item the player picked up and in what hand.
3) I needed the animations to play properly on each hand for each item.
One way of implementing this cheaply would be to hide the player mesh when picking up an item like Layers of Fear VR (Bloober Team, 2019), so the player has 'hands' showing until they interact with or pick up an object- however in my opinion this detracts from the player immersion when playing the game. With this in mind, I felt I had to look at alternate options.
I tried several methods - such as starting to re-build the Unreal Engine 4.26 pick up system in Unreal 4.27
| Old Pick up system |
The idea of re-making the system using the newer unreal components however would have meant also rebuilding the player blueprint that I'd already been working on and potentially losing work- so I considered trying to implement the animation call into the picked up item itself which would tell the animation blueprint which hand it was grabbed in and what item it was; however this would have been a very costly was of implementing the system as the 'Cast' node is very expensive in terms of performance.
This kept me trying to work out how I could get the hand, the item and animate it.
The solution was eventually fairly simple. I created an enum table with all the different items that i'd like to have in my game.
| Enum table showing the items you can pick up |
The Enum table was then duplicated to each hand and then input into the animation blueprint, this meant that if each hand could get the information about what it was holding then it could update the animation accordingly based on an animation blendspace.
| Enum being fed into the blendspace |
I had one blendspace for each hand, however I still did not have a way of knowing which hand held the object, until I realised that this information was already inside the player blueprint and already implemented, so I tried several methods out that did not work, this is where I found out I had to duplicate one enum for each hand otherwise you would pick up an item and, if it used one enum, then you would be stuck with both hands playing the same information.
Inside the grab component I added a variable for "itemtype Right" and "Itemtype left" for each hand
those variables are then read by the player blueprint and update according to which hand picked up the object and animating correctly.
| The finished player blueprint reading the item type on the right hand |
The amount of time that this took to implement has had an impact on my project schedule, meaning that I will have less time to work on the core mechanics but I believe that it has been worth it and while my implementation of the animation could be more refined- I'm happy with where the system is and I feel that to dedicate more time could jeopardise the remaining content that I have left to build
No comments:
Post a Comment