Fandom

GameBlender 4 Ever

FSM with logic bricks 1 phase 0

58pages on
this wiki
Add New Page
Talk0 Share

Phase 0 - PreparationEdit

GeneralEdit

This tutorial will not describe how to produce characters, meshes or animations. There are enough tutorials around to teach you this skills. You might find some tipps and tricks here. The purpose of this tutorial is to show you how to make the logic brick do what you want.

Therefore it is important to know what you want. Even with this simple example in this tutorial you can see that changing your goals can invalidate all your previous work. So lets start with the goals.

GoalsEdit

  • Have a character that can do following things:
  • Standing around (with a little motion that it looks alive).
  • Starts walking on user interaction.
  • Picking up a ball on user interaction.
  • After picking up the ball standing around while holding the ball.
  • Walk with the ball on user action.
  • Dropping the ball on user action.
  • Staying around after dropping the ball
  • The animations should be smooth blend together without "jumps".
  • The ball should look like taken by the character and dropped to the ground.

That are the goals after all phases are completed. Not everything is described in the goals. It looks more like general ideas. At least this goals should be achived when we are finished.

Lets be a bit more specific when defining the

User InteractionEdit

We will only use keyboard input:

KeyInteraction
"s"stay around
"w"walk around
"b"pickup the ball
"d"drop the ball


ObjectsEdit

What do we need?


The CharacterEdit

The character consist of an armature (skeleton) with bones. To the armature the characters skin is attached (in armature mode). The skin should contain vertex groups according to the bones name. The armature requires some actions (animations). The required actions can be found in the section Actions. The character of this tutorial is based on the "Blender Documentation Volume I". look for "Your first animation in 30 + 30 minutes". It teaches you to create a character named GUS.

As an alternative you can use an own character.

If you do not have a character or you do not want to follow the above tutorial you can download GUS at the end of this page.

The BallEdit

The ball can be picked up. It is just the default ICO-Sphere with a simple texture. Build your own or load it together with GUS at the end of this page.

But wait. We can't change parents during the game. Also parent-to-bone does not work.

There is a trick. We will need 3 balls looking exactly the same:

  • ball_floor - resting on the floor.
  • ball_GUS - GUS us holding the ball with his right arm.
  • ball_drop - the falling ball.

Each of them has an IPO curve. See section IPOs for details.

The EnvironmentEdit

Is just a plane representing the ground. No animation required.

AnimationEdit

ActionsEdit

Here is a list of actions and what they should do:

Action name Start End Comments
GUS_standing 1 151 Standing animation repeatable
GUS_walking 1 41 Walking animation repeatable
GUS_ball_pickup 1 141 Pickup animation. Grap at frame 41.
GUS_ball_dropping 1 61 Dropping animation. Release at frame 21.
GUS_ball_standing 1 151 Standing animation with ball repeatable.
GUS_ball_walking 1 81 Walking animation with ball repeatable.

The walking and standing animations require blending (5 frames) to make a smooth transition between them.

As an alternative the animations stand-to-walk and walk-to-stand would be required (with and without the ball).

IPOsEdit

ball_floorEdit

Keys: 0 - invisible, 1 - visible.

This object needs a possibility to hide itself. There are several methods. My method is to scale the object down to 0.

Add a scale IPO key at frame 0 when the object is hidden. Add a scale IPO key at frame 1 when the object is present. Call the IPO curve "Scale_0".

Alternatives:

  • move it under the floor.
  • use the visibility actuator

ball_GUSEdit

Keys: 0 - invisible, 1 - visible.

This object needs the same IPO curve as ball_floor.

  • Go to the IPO curve editor.
  • Select ball_GUS.
  • Select the IPO curve "Scale_0" from above.

The pickup, hold and drop animations are performed by the armature actions as ball_GUS is parented to the armature.

ball_dropEdit

Keys: 0 - invisible, 1 - visible at release position, 101 - visible at rest position

This one is not that simple.

The ball must perform a falling animation from the point where GUS releases the ball until the position where the ball rests on the ground. The start and end points are given by ball_GUS and Ball_floor. To make it look natural I decided to temporarily make the ball_drop an actor and record the IPO when it is falling.

Here is how I did that:

  • Duplicate the ball_floor to ball_floor.001.
  • Let the armature perform the pickup action in pose mode (GUS_ball_pickup).
  • Go to the frame where GUS graps the ball (21).
  • Parent ball_floor.001 to the bone Arm.R (parent-to-bone).
  • Select the dropping action (GUS_ball_dropping).
  • Go to the frame where GUS releases the ball (41).
  • Unparent ball_floor.001 but keep the transformation. The ball should not change the location/rotation.
  • Copy the location/rotation to the ball_drop (hint: select ball_drop; shift select ball_floor.001; <^c>; location; <^c> rotation)
  • Remove ball_floor.001 or move it to a hidden layer.
  • Now we have the initial position. Add the location/rotation IPO key with <i>
  • Ensure you have a ground plane
  • Make ball_drop to a rigid actor.
  • Start the Gameengine and look how the ball falls.
  • Adjust the material settings until ou are happy with the animation.
  • Make sure the ball will stay near the ball_floor.
  • Switch on Game/Record game Physics to IPO.
  • Run the game engine until the Ball stays still.
  • Switch off Game/Record game Physics to IPO.
  • Disle actor on ball_drop.
  • Go to the IPO window of ball_drop.
  • Call the IPO curve "ball_drop".
  • Determine an end frame when the falling is finished (e.g. 101).
  • Adjust the IPO curve to reduce the number of keys. Only LocZ curve should be relevant. Remove all other curves. This saves a lot of disc space.
  • Go to the first frame add location and rotation IPO keys.
  • The ball is likely not at the same position (rotation as the ball_floor. Therefore go to the last frame (101).
  • Copy the location and rotation from ball_floor. Add the IPO keys at the animation end.
  • If necessary adjust the IPO curves to make the fall look natural.

To hide the object we need the same scale IPO curves as ball_floor. This time they needs to be copied to the existing curves. You can do this with the buffer.

Sample downloadEdit

Download GUS, balls and animations from Polorix

It is the final blend file just without the logic bricks.

Back

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.