Movement mechanics

Almost the first time doing serious bipedal movement mechanics and animation. Let’s make a first step into the complex character animation (or not). Anyway, here’s the workflow. Honestly, once I’ve been involved in such an affair… And things did not go very well, but that was then. Anyways, now is the first real attempt to create an acceptable bipedal character movement animation and mechanics. First, I’ve made a complete redesign of an old version of movement mechanic, which was a special pawn and was very hard to use. Well, now it looks shiny and new, now this code goes to a new separate mechanism — LBCharacterWalkMovementMechanism, which is now based on LBCharacterMovementMechanism (empty at the moment, lol) and conains all the code, needed for performing pawn movement and blending the animation. It also has all parameters, which are used to regulate pawn’s speed and acceleration.

walk_movement_mechanism

It has the forward speed parameter and a forward speed coefficient to handle forward speed, same to the sidestep (strafe?) speed. Also it has accel rate, which is used to speed the pawn up, when it wants to run. Another important thing here is the angular speed, which is represented by angular speed parameter and an angular speed coefficient, which are used to handle pawn’s rotation. Also it has move direction, which is used to point the desired movement direction. It’s worth noting, that pawn rotation is quite an interesting task itself (later on this). Second, I’ve made several frames of animation for the character, the walker (xw_char). It wasn’t easy, because someone’s left in it’s feet only one bone. Maybe it was even me. Anyways, there are two fairly appropriate animations sequences:

Simple walk animation:

xenowalker_walk_gifxenowalker_walk_gif_side

Simple run animation:

xenowalker_run_gifxenowalker_run_gif_side

Other intermediate and supportive animations are quite crappy to be shown here. It should be noted that I used the walk and run cycle tutorials by Richard Williams as a reference (found all over the internet) for my walk and run animations. As a result, we’ve got the following animtree:

Where BlendByAngSpeed node does blending between middle, left and right turn sequences and BlendByFwdSpeed node does blending between walk and run sequences. Also, while blending between walk and run is quite a simple task, but blending between rotations seems to be more complex. Using unique animation sequences turned out be the best way to solve this problem, others, like using direct bone rotations may cause weired effects in my animtree during blending between states, for example. Finally, we’ve got the result, let’s see how does it look all together:

Walk and run animations in game:

Turn and turn in place animations in game:

However, complex tests reveal some flaws, like minor body jerking and leg rattling, also there’s still no jump and sidestep implementation. And ofcourse, the camera is terrible, but controlling with joystick (gamepad) partially solves the problem. Nevertheless, in general it looks not too bad.

Movement mechanics

Interaction mechanics

Lets make another step into a complex interaction system. The final target is the ability to interact with most objects in the level. There are many possible kinds of interactions. As I see, they are:

  • Pick up, hold, drop down (charater->object)
  • Enter, stay, leave some area (character->world)
  • Touch, hit some object (characters<->objects)
  • Intersect the line (ray) (characters<->objects)
  • Triggered interaction (player, script->characters, objects)
  • Conditional, programmed (script<->characters, objects)
  • Combinations of listed above

First of all, LBInteractableMechanism provides a basic framework for actor interactions, this mechanism carries out all data transaction between LBActor, LBPawn and other actor classes. Two first interactions are implemented by LBInventoryPawnMechanism, LBAreaCheckingMechanism and LBLocationTriggerMechanism. Line and ray intersections are implemented by LBTargetingPawnMechanism. Triggered interactions are partially implemented by LBKismetEventActivatorLBGet***SeqLBSetP***Seq.

Let’s test this interaction system on a pre-set character in a test level. The desired result is an ability to put objects in certain places, where their presence causes certain events. In this example only three interaction types are involved: the first, the second and the fifth. The procedure should be like this:

  • The player initiates the drop-down action by the character
  • The carried object is released from the inventory
  • If this object is put in a specified location:
    • The object is forced to move to specific point
    • The special effect is shown

Projected to a Kismet-Mechanism model, this procedure takes the following form.

First, the key is pressed by a player, which tells the LBSetParamIntSeq to set ActivateInteraction parameter of the Pawn_Interactable_Controller to 6. Then the put down sequence is executed by the pawn and it’s mechanisms.

activate_interaction_seq

After the object is on the floor, it interacts with LBLocationTriggerMechanism, which checks its area every n-th second (tick) of game time (yes, it’s quite expensive). If the objects passes center-to-center distance test, a special Kismet event is activated, which is connected to a group of LBSetParamBoolSeq. The first LBSetParamBoolSeq node sets the parameter bEnabled of LBTargetedMovementMechanism in our object to true, so it could move to the center point. The second node sets the parameter bVisible of LBVisibilityModifier in special effect object to true, so we could see the glowing.

event_handle_seq.PNG

That’s it. Now the objects have an ability to several consequences. In our case, the capsule, carried by a character to certain stand, moves to it center and triggers a glow effect.

interaction

Of course, it’s not enough, because there are three more interactions (at least), that need to be implemented. Some of them have their preliminary handlers, and some of them don’t. The further research and development is carried out.

Interaction mechanics