Rig Improvements, Buttons, Hazards, and Feedback

Posted by Josiah Purtlebaugh on Wednesday, September 2, 2020

Summary of accomplishment:

  • Updated the placeholder rig to add arm IK and improve supination and pronation of lower arms
  • Imported the button block and configured it to activate/deactivate based on player collision
  • Added a BallSpawner_BP class that spawns hazards (balls)
  • Added feedback to the placeholder character that causes the mesh to change color and be pushed back when taking damage
  • Added an additional camera and enabled switching between them

I made some significant progress since the last update so I’ll get right into it. First, I improved the rig to allow cleaner supination/pronation (that is twisting the forearm) and IK to the arms. I’m having trouble making clean attack animations so hopefully these improvements will help me get better results.

To describe the process a bit, I took the following steps to add clean twisting to the arms:

  1. Duplicate the lower arm bone and hide the original
  2. Subdivide the lower arm bone twice and name the bones LowerArmTwist1, LowerArmTwist2, and LowerArmTwist3
  3. Confirm that LowerArmTwist1 is parented to the UpperArm, 2 is parented to 1, and 3 is parented to 2.
  4. Set each of the twist bones to deform and disable deforming on the original LowerArm bone
  5. Add a Copy Rotation constraint to the LowerArmTwist3 so that it copies the rotation of the hand; set the influence to 0.9
  6. Repeat step 4 with Twist2, copying the rotation of Twist3 with an influence of 0.7
  7. Repeat step 4 with Twist3, copying the rotation of Twist2 with an influence 0f 0.3

Now rotating the hand should cleanly rotate the wrist without causing the arm mesh to collapse inward. I won’t cover the details of adding arm IK here as there are numerous Youtube tutorials covering that subject and it is fairly simple.

Next, I added a ButtonBlock_BP to the project that uses the animation I created in the previous post. It has a 4-stage animation state machine that triggers it to idle in the pressed or unpressed position and it will transition to those states based on whether the play is colliding with it or not.

The new BallSpawner_BP class is a simple addition to create a new obstacle to be placed in the world. It contains a soft class reference to a basic sphere and it spawns the spheres on a timer and gives them a push with Add Impulse. I enabled physics and collisions and set their mass to 1000kg.

I also updated the player to respond to collisions by being forced backwards and momentarily flashing a red color. It’s starting to feel a little bit like a game!

Finally, I also added a simple camera change mechanism when the player pushes c.