KX_CharacterWrapper

hello I have a cube with the physics type set to ‘character’. how do I access the properties of the KX_CharacterWrapper with python code. Thanks.

I already tried:


def initJump(cont):
    own = cont.owner
    
    own.jump()

but I get an error:


Blender Game Engine Started
Python script error - object 'Cube', controller 'Python':
Traceback (most recent call last):
  File "\character.py", line 9, in initJump
AttributeError: 'KX_GameObject' object has no attribute 'jump'
Python script error - object 'Cube', controller 'Python':
Traceback (most recent call last):
  File "\character.py", line 9, in initJump
AttributeError: 'KX_GameObject' object has no attribute 'jump'
Blender Game Engine Finished



You need to use this: http://www.blender.org/documentation/blender_python_api_2_71_release/bge.constraints.html#bge.constraints.getCharacter

awsome. Thanks

I have noticed that when the top of my character collides with a wall the jumping gets reset. This creates the possibility for infinite jumping without touching the ground. Is there a way to fix this.

Sometimes I really wonder how moguri decides to answer posts…

Indeed, either very good at refraining from replies, or there’s an “Obscure / ‘self-implemented feature’ support request alert” that he possess.

You can try using a capsule collision shape for your character if you are not already. The downside, is that the capsule can slide around a bit when your character is not moving. In general, Bullet’s character controller is rather underwhelming, and sometimes just not usable.

As for how I answer posts, I tend to look at most posts in this discussion forum, but I tend to not get involved in the long discussions for a couple of reasons: 1) To let the discussion continue without me influencing it (to get a better understanding of the community), or 2) I don’t always have the time at hand to form a proper, well-written response.