# How to use KX_CharacterWrapper.walkDirection

I want to make a character, which would move, and I want to use character physics and python for easyer controll. I know you get the character wrapper with wraper = bge.constraints.getCharacter(own) Then I want to make it move, but I can't figure out how walkDirection works. I did it like so:

import bge

cont = bge.logic.getCurrentController()
own = cont.owner

wraper = bge.constraints.getCharacter(own)
direction = (0, 1, 0)
wraper.walkDirection(direction)


But whnever I press the key and run the code I get an error: 'Vector' object not callable I can't find any examples of how that's done on the intrnet, and I tryed changing the code many times.

Please, can someone tell me how it's done? Thanks.

The wraper.walkDirection is a property of type Vector and not a function so you should do an assignment :

wraper.walkDirection = direction


to move in the local space orientation multiply the direction vector by the orientation matrix of the object :

direction = own.orientation*Vector((0, 0.1, 0))


you should include the Vector type by adding this line :

from mathutils import Vector

• Thanks a lot. It works now. But is it possible to make the character move according to local rotation of the object (just like with applyMovement(x, y, z), Local) – Roki Podpecan May 22 '15 at 18:07
• @RokiPodpecan Updated the answer to include this – Chebhou May 22 '15 at 18:30
• @RokiPodpecan thanks , I have added that : ) – Chebhou May 22 '15 at 18:51