Blender 3D News and Training

Bow and Arrow – Part 2

Posted by Chris Plush on Sep 13, 2012

This tutorial will take you through taking our rigged bow and arrow from the last tutorial and putting it into the game engine in Blender 2.6. You’ll learn how to shoot arrows at different speeds depending on how far back the bow string is pulled, and how to have these arrows stick into whatever they hit.

VERSION UPDATE: There’s a bug in later Blender versions that make the arrow drop straight down when the bow string is pulled all the way back. To work around this I’ve added 4 lines after the “else” statement and changed the launcher.actuators line and that fixes it. Check out the updated script below:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner
pull = cont.actuators["pull"]
fire = cont.actuators["fire"]
space = cont.sensors["space"]
launcher = bge.logic.getSceneList()[0].objects["arrow_launcher"]

if space.positive:
    pull.frameStart = 1
    pull.frameEnd = 40

    if pull.frame == 0:
        frame = 40
        frame = pull.frame
    launcher.actuators["add_arrow"].linearVelocity = [-(pull.frame * 15), 0, 0]
    pull.frameStart = 41
    pull.frameEnd = 46

Chapter List –

01:16 – Summary of how things are going to work
02:10 – Working with the arrows(duplicating to create a new dynamic arrow, parenting original arrow to the armature, and editing the bow animation to make the arrow pull back properly, changing physics properties, adding logic bricks)
07:10 – Summary of how the python script will work
07:40 – Adding logic bricks to the armature
09:15 – Creating a new python script
13:45 – Adding more logic bricks to the arrow
14:35 – Creating a new empty object to shoot arrows from(and adding logic bricks for it)
17:09 – Changing physics properties for the dynamic arrow
17:41 – Finishing the python script
21:40 – Adding logic bricks to the dynamic arrow to add artificial gravity and trajectory, and making it stick into things it hits
24:22 – Adding the “stick” property to objects in the scene
25:40 – Adding keyboard controls to rotate the bow

Related Posts

Comments (19)

Guys, i need some advice on how to play the final result of this game on the blender game engine with all the textures. When i press ‘p’ on camera view and on camera mode every thing turns to white except the tree backs. Is there any key i can use to enjoy testing the game on the game engine. Alt A, only moves the pull animations through the frames but nothing happens. Please Help coz am very new and i want to enjoy blender as well as you guys. In short help me on how to make sure the… Read more »

Okay hi am completely new to blender and unity how do i export the result of this tutorial to unity with the pull and fire animations.Any help is appreciated. I tried with importing the fbx of the selected objects but it only has the pull animation but it does not fire.

Vadim Zalyubovskiy
Vadim Zalyubovskiy

You are amazing! Let`s kill it all! We need a crysis port to the blender.

Chris Plush

haha thanks!


this was super useful

archery fan

Awesome tutorial. Just one thing, you should’ve put the arrow on the left side of the handle and rotated the bow to the right a bit. Right handed people generally hold the bow with their left hand and draw with their right; thus the arrow would go on the left side. For left handed people it’s the opposite.

Corey Windom
Corey Windom

its a game…..who cares