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)

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
  • $\begingroup$ 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) $\endgroup$ – Roki Podpecan May 22 '15 at 18:07
  • $\begingroup$ @RokiPodpecan Updated the answer to include this $\endgroup$ – Chebhou May 22 '15 at 18:30
  • $\begingroup$ @RokiPodpecan thanks , I have added that : ) $\endgroup$ – Chebhou May 22 '15 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.