YoFrankie example overview
Scene Overview
Here's the scene when you just open the example :
Look at that sheep :
- The Sheep model : Its only a graphical model, there is no physics or actions bound to it (only animations)
- The cube around around the sheep : It's the sheep bounding box.
This is that cube who will receive physics and movement scripts
- The small box who stands at the sheep feets : It's the Feet box, it has physics proprieties and its set to ghost mode.
That is used to count if there is a collision with the ground or not.
Your probably noticed that when you move the "player box", the sheep model and
the feet box are moving together with it,
but you still can move sheep and
feet box individually.
This is because the sheep and the feet box are linked to the player box.
Same process for the camera (so if theres a wall on its way, the camera won't go through)
Script Overview
The 3 objects who will receive modifications :
Sheep, for animation only.
Player, For physics and movements.
Feet, To check collision with the ground.
The line "coll = get..." is for the feet box. this is that one
who will count the number of collisions between feet and the ground
and "move = 0" will be for movement
Here, the force that will make the player move is stored in move == 1.
And here, when key LEFT is pressed, it will rotate the player AND move it
forward because move = 1 is used