I want to make my character fall down at an edge, how to make it doing some animation while falling down in a certain height not a little.And then when touching the ground it change to a dead pose ?
My idea would be to start a timer when there is no collion to the ground (You need to exclude jumps). After a certain amount of time you start the falling animation. When getting a collision to the ground again stop the falling animation and start the death animation.
If you work with states you can have it like this:
current state – event --> next state (action)
walk – no collision to ground --> falling short (reset timer to zero, play falling short)
falling short – timer greater limit --> falling long (play falling long)
falling long – collision to the ground --> death (play death)
falling short – collision to the ground --> drop (play droping)
You know I am a bit confused about your sugestion.Can you explain it step by step how to proceed. Here is the blend files
Please if possible I would like if you do it with logic not python thank. Also how to avoid the function of another motion while the character fall down. I want just the character play the hit action and not affected by the walk motion or the left and right motion
Here is my recent files
Your blend looks good. At this stage I strongly advice you to use a FSM. You can google for FSM or finite state machine for details. At least there are some wiki pages. You can build a FSM with logic bricks as well as with Python.
Basicly you add a property e.g. state (string or int does not matter).
Than you define a set of states e.g. init, stand,walk, jump, fall, death. Just write down somewhere. If you use numbers write down the meaning e.g. init = 0, walk = 1.
You define one state as start state and set the initial value of the property state to it.
You can add property sensors that check the property state for a state value. You can combine this sensors with other sensors e.g. keyboard sensor to trigger a property actuator. The property actuator can change the property state to a new state.
Example: property state = walk AND key = Space -> property state = jump
To see the animation of the current state you can add an action actuator to play your animation.
property state changed AND property state = walk -> action walk
property state changed AND property state = jump -> action jump
property state changed AND property state = fall -> action fall
With this you can have a complex set of animations. The best is to write down the states, transitions (state changes) and the actions before you add the logic bricks. Also naming the sensors (e.g. sSpace, sCollision, sStateJump) and actuators (e.g. aJump, aStateJump) can help to keep it readable. It is difficult to say what sensor1or sensor2 are doing without expanding the logic brick (my opinion).
I hope you understand what I mean.
Hi, Thanks for replying cause i was waiting for an answer.You know I am new to blender game engine and its difficult to understand what you say. Please can you make the necessary change on my blend. I was trying to make the falling in my way what do you think. Here is my recent blend. Also thing become more difficult while trying to make the character push the box or the sphere.I don’t know how make the character hold them it in the same position so that if i try to move backward the character pull those object until i press a key to stop.http://uploader.polorix.net//files/402/character%20final2.blend
here is a working armature and mesh that might help you out.
hope that helps…
I updated you blend file. You can find it here:
As you will see there is only one property “state” holding all possible states.
As you can see there lots and losts of logic bricks. Especially the connection between them are difficult to identify. Therefore you need this sketch:
The names in the circles are the states. The arrows are the transitions between the states. The labels on the arrows are the events that trigger the transition. Events with ! are meant to be negative (false). I left out the actions.
Here is how to read it:
The start state is “breath” (with the double circle). when pressing the up key sensor Up is true and lead to the next statte “walk”. When pressing leftAlt the leaftAlt key sensor will be true as well. Both sensors Up and leftAlt are true and lead to the next state “run”. e.t.c
Actions are performed when entering a state (entry actions) they can be animations as well as motions or other things.
I named the controllers that you can see from what state they switch to the next one.
Nice one Monster! Thanks.
But the jump function seems to work weirdly?!
The names of all logic bricks are for better readablility. They do not change the function of a logic brick.
The state sensors sStateCCCC will identify the current state where Cccc is the name of the curent state. If they are true the logic should perform the entry actions e.g. move and/or play animation. (I named the related controllers cDoCCCC).
The the state sensors together with the other sensors will trigger transitions between the states. You can call them transition controller. I named the transition controllers cCCCCNNNN where CCCC is the current state and NNNN the next state e.g. “cBreathWalk” is a transition from “breath” to “walk”. At least the sensor of the current state should be connected to the transition controller. The sensors to be connected can be found in the above sketch (arrow labels).
The actuators to change the state are called aStateNNNN where NNNN is the next state e.g. aStateWalk assigns “walk” to the property state. This actuators should be connected to the transition controllers.
As the logic looks very complex it is important to write down what you want. In the above sketch you can see there is no transition from breath to jump. therefore the actor can not jump when staying around. To add this you should draw an arrow from breath to jump adding the conditions to make it true.
Lets say the condition should be ground (collision with the ground) and space (space key pressed). Write “ground” and “space” to the arrow.
Now add a “transition” controller cBreathJump. Connect the sensors sStateBreath, sGround and sSpace to the transition controller. Finally connect the actuator aStateJump to the controller cBreathJump. Thats it.
The same way can be used for a transition from “jump” to “breath”.
The file I provided you i not that perfect. I saw following problems:
- When the actor is in state “fall” he can go into state “walk” when pressing the Up key.
- There is no transition from “breath” to “drop”. This could be a problem when releasing the Up key when droping and still colliding with ground (head/shoulder).
- The left and right keys and the actors rotation are completly independend from the states. They might be bound to the “breath”, “walk” and “run” states.
- The ground objects have to much faces just to be flat.I hope this helps you a bit.
thank you so much for your time and effort to share your skill.I will learn all the change you make and see what is there function. Thank You again.