Question About Character Actions Like RE6 or GoW in BGE

Hello guys need some help here.

I’m making a TPS game and I have some questions regarding animation, well, I think it’s about animation.

I want to do something like Resident Evil 6 and Gears of War with a camera over the shoulder, that’s no problem, since there are alot of tutorials in here. The big problem is regarding the character.

I can’t find a single tutorials explain how to make diferent parts of the character’s body move separately. Something like aiming to the left with RMB looking up or down with the mouse while runing to the right on WASD. Or even stay still, hold RMB to aim in any direction with the mouse.

Like this video. The guy used Blender to do it (turn off the sound, it’s noisy):

you can set up your character rig so certain bones are using copy location/orientation constraints on empties or other objects which in turn you can move around in the game engine. its basically a combination of building a rig that does the motions you want based on one or few objects you can access in the game engine and moving those objects around where you need them with a clever camera rig and some scripting.

For something like this if you’re not comfortable with python then spend some time learning it, because it’s pretty much required for anything serious. This will involve making a number of animations and blending them on different channels, so I’d plan out which channels you want to do what- and if you make an animation such as an aiming animation, only add keyframes on bones actively involved in the animation or the blending will be messy.

Personally I’d make an aiming animation that goes from aiming all the way down to all the way up, while pointing straight forward. Then you can use the mouse X movement to rotate the whole character (at the physics bounds level) and then the mouse Y movement to “scroll” through the animation- as the mouse moves up, advance the animation, and vice versa. This animation should move the arms, the head, and the torso, and be higher priority than any other animation.

The walking should be four different animations- one for walking forwards, one walking backwards, one walking to the each side while facing forwards (either side-stepping, or the waist and hips swiveling to face the walking direction- the second option is more natural looking but more difficult to make) You will then find the direction the player is walking in relation to their facing and choose and mix animations accordingly:
-If the player’s local Y velocity is positive, use the forward walking animation, while if it’s negative use the backward walking animation.
-Now in another channel (still lower priority than the aiming animation) use whether the local X velocity is positive or negative to choose the right or left walking animation, and then get the ratio of X to Y local velocity, and set the blending strength of the sideways walking channel to match (so the more sideways the character is walking, the more sideways animation is played)
If you want to also have running as an option you should make a separate set of running animations to match and mix them into the same channels with a little blendin for a smooth transition.

You can have the walk animations include movement of the arms and torso, and if you apply the aiming animation with a higher priority it will override the torso and arm bone animations. That way you can disable the aiming animation and it will switch back to a regular walk.

Coding it’s not a problem, the problem is only to figure it out how to do it, but I think now I have an idea thanks to both of you.

Was playing RE6 just now and I saw how the animation works in the game. It shouldn’t be so hard to do it if I make like it.

Since the character can’t run and shoot, only walk, they have 4 basic animation for the legs while aiming, two if you think about it since the other 2 are just the reverse. For aiming it has only 2 animation, aiming UP and aiming DOWN, for horizontal, only need to turn the torso, and I can make like you said on the second paragraph Captain.

Well, going to wait for my partner to finish modeling, rigging and animating the character, as soon as I have it done, I’ll post it here so you guys can see it.

I spent a little time messing around with coding the system I described last night, and I ran into one hitch that’s worth noting- if an object is playing an action, and you tell it to play the same action with different parameters (for example, with a different layer weight value) it will ignore that command. You have to stop the action and then reassign it every frame if you want to change values for the action, which means you can’t use blendin, unless you do it manually with a property and layer weight.

It’s also worth making your own property to keep track of the animation frame, and advancing it yourself, to make sure the two different walking channels keep their frames synchronized (otherwise whenever one of them changes animations, it will start over while the other channel continues from where it already was, and the animation will get garbled)

Um, just set up the cursor as a IK target and then limit how far the mouse can go from centered,

So the IK targets are getting the actions played, and the armature is

always--------------and--------------Run armature

So head + arms are tracking cursor, while body is affected by actions or…
TorqueWalk :slight_smile: like this file here :slight_smile:

Attachments

MouseCrackedOut.blend (693 KB)progressflip.blend (4.23 MB)

My animations are sloppy (especially the vertical aiming one…), my code is messy, and I didn’t do the action blending, smooth acceleration, or running, but here’s the basic principle of it.

Attachments

TPS Walk Rig.blend (976 KB)

As soon as I get home I’ll test it Captain, thanks.

Wow, it’s really good Captain just need a few tweaks. I tried to modify it by myself, but I’m not familiar with the Blender API, still learning it.

First of all, since it’s like RE6 or GoW, when the character is idle, it would be nice to be able to rotate the camera around the character.

Second, I think you should put the zoom when you aim like this:


I prefer like this, showing only from the sholders isn’t nice, you must show some of his back, but never cross the waist line.

Third and last one. The vertical limit is too high, it should be like this:


The limits and zooming are simple to change- just alter the animations (I’ve added an explanation of which bones to change in the file). Being able to rotate the camera around the character while out of zoomed mode is more work because it means changing to an entirely different control system when out of zoomed- the directional input should relate to the way the camera is facing, rather than to the character’s local coordinates, and the character should be smoothly rotated to face the direction it is walking rather than walking sideways or backwards. (This also means it’s a good idea to make a set of turning animations that are blended in if the player wants to make a turn that reverses the character’s direction, which adds another layer of complexity to the animations)

In the meantime I also went ahead and made a version without the mouse drift, and with smoother movement and animations. I also added shooting. I’m in the process of going back and putting documentation in the whole thing but I figured I’d put up the functional version.

There’s still some twitching in the animations but I’m fairly sure that’s just a side effect of my having thrown all the animations together in a few minutes.

[edit] I have commented the living daylights out of the file. I am not sure how comfortable you are with scripting and vector math, so I went ahead and explained some pretty basic concepts- apologies if some of the stuff is below your level. I also described important parts of the way I set up the rig, and why I did it that way. Hopefully it’s to a point where you can understand why I did and why, and alter it to suit your needs.

Perhaps I will put this in resources as well.

Attachments

TPS Walk Rig.blend (1.03 MB)

I should probably also reiterate that I made this more as an example than a template- a lot of the things are done specifically the way I like to do them, and not necessarily the best way. That said, I appreciate the credit!

Also here’s a version with the script rearranged (I figured the aiming bit should be at the top because whether you’re aiming or not will effect movement speed down the line, also I pulled some variables up together near the top of the script for easier adjustment)
I also put in some of the groundwork for running, I haven’t made any animations or put any thought into the issue of blending two walks and two runs together (especially since a run loop takes more time than a walkloop so synchronizing the animations will be tricky) but you can hold down shift and the character will start walking fast.
I also added some slow parent to the camera so the aiming is smoother.

It also occurred to me that one advantage of blending directional walk animations together is that when turning the character while walking, the character’s feet stay more naturally planted on the ground (assuming the feet match the movement speed to begin with, the animations I made don’t)

I’ll have to look into that link to see what tricks I can learn, but for now I need to play some planetside.

Attachments

TPS Walk Rig 0.0.3.blend (1.04 MB)

Well, I don’t know programmers that do the same thing to solve a problem or to create a program.

You doing this can help other people create their own TPS camera RE like style and I think this is already good enough.

I don’t even know if I’m going to use your own code, don’t know, perhaps by the end of the year I will have my own code to do the same, but I guarantee I’ll use yours as base to create mine :wink:

I’ve started a thread in the resources forum, so newer versions of the file will be there.