Character walkDirection not moving character

I have a very simple setup to test character movement.



import bge
from mathutils import Vector




def main():


 cont = bge.logic.getCurrentController()
 own = cont.owner
 
 obj = bge.logic.getCurrentScene().objects
 char = bge.constraints.getCharacter
 
 playObj = obj["Cube"]
 play = char("Cube")
 
 print("On ground ",play.onGround)
 
 walkDirection = Vector((1.0,0.0,0.0))
 play.walkDirection


main()



The game setup is also very simple

However, i can’t get the character to move. I have also attached the blend file. I know this is something simple, but i just don’t see why it won’t move. I added the onGround output to check that the character existed.

Attachments

test.blend (531 KB)


import bge

def main():

 char = bge.constraints.getCharacter('Cube')
 char.walkDirection = [0.0,0.3,0.0]

main()

the constraint need a name, so cube is the name of your player lets feed it directly.
then we need to set the WalkDirection, the direction is actually a list[x,y,z] not a vector.

Also do not use double naming.
the character uses walkDirection, so never use that walkDirection to actually set a direction. using the same name can cause unwanted behavior/errors.

in this case, you needed to set the walkDirection

Thanks, i knew it was something simple