Some help with animations and camera work

So I’m always running into these problems after I return to the bge after months to years, but basically I need the walking animation of my character model to player and loop only while a movement key is held down. Another thing is the camera, I am curious about how to go about a camera that changes through out the level (think the old resident evil or onimusha games). My guess was to make several key frames for this that are activated when the play enters a certain area, like it would go to frame(s) when he player collides with an invisible cube, but I’m not quite sure how to do this. The last thing would have to do with my rig; I’m not quite sure whether or not the player will be using different weapons and shields throughout the game, so my idea was to had an invisible cube where the sword and shield would be and have that cube be attached to a bone, and have the various weapons on another layer parented to it so that they could change and keep the same animation, but for some reason they don’t seem to follow the animations. Here’s the blend.

knight game.blend (1.15 MB)

Ok, so, nice rig but…

you need to use true level pulse logic

second, you need a animation state controller,

when a character walks, it is not a even motion throughout and also, if you let go of forward, you don’t want the animation to continue while the force is not or vice versa,

I use this system to control animation state,

In a game object have the property “Anim”

Have
Keyboard “Up arrow” TRUE pulse mode---------------and-------------------Property -Assign- Anim = 1
Property -“Anim” = 0---------------------------------------------/

Property -“Anim” interval min:1 max:99-------------and-------------------Property -Add Anim 1

Property -“Anim” = 100 ----------------------------------and-------------------Property -Assign Anim = 0

Property is changed------------------------------------and-------------------Action-Property mode- anim

So this, will play a 100 frame walk cycle,

In the physics object the animated mesh armature is parented to

Always-------------------and--------------------Copy property “Anim”

if Anim Min:X -> Max:---------and ---------------Apply forces

this way, the physics object can apply “bursts” of force during the right part of the walk

Also this way a walk cycle will always finish even if you let go.

Here is a demo,

Cube = Animated mesh
Empty = Physics object

Attachments

3rd_person_cam_beta (1).blend (469 KB)

Another thing is the camera, I am curious about how to go about a camera that changes through out the level (think the old resident evil or onimusha games).

I did it with python but maybe logic solution could work as well.

I used empty with different collision group than player and the world. Namely 3. The empty is parented to player and raycasts - Z axis looking for object with property “CameraZone”. These are camera zones that are just simple planes with collision group 3, sometimes multiple ones for different shape zones. If it finds such item (mostly it does :slight_smile: ) it changes the scene.active_camera to zone name plus “_cam” if that wasn’t the active camera at the moment.

The zones have barely visible semi-transparent textures and I also have the cameras parented to their zones for added clarity in level design.

BTW there’s a stupid minor bug that this setup highlights: if you try to use camera fly mode it also moves the zone that is the parent of the camera.