class bge.types.KX_CharacterWrapper(PyObjectPlus)
A wrapper to expose character physics options.
onGroundWhether or not the character is on the ground. (read-only)
[TABLE=“class: docutils field-list”]
[TR=“class: field-odd field”]
[TH=“class: field-name”]Type :[/TH]
boolean
[/TR]
[/TABLE]
I have no idea how to read the api documentation…I just don’t get it sorry… I see
‘bge.types.KX_CharacterWrapper(PyObjectPlus)’ and I assume it is
bge.types.KX_CharacterWrapper(‘expecting something here’)
if own.bge.types…blah blah:).onGround == True: …nope…
you get the idea…I have NO idea
so how do I use this…I mean I can just rayCast, but this is built in a probably faster than yet another rayCast.
The easiest way seems to be using collision sensor and test for the “ground” property or you might use collision callback and test the alignment of the z axis against the normal
lol…in the first case it is the child object of a collider…it is a rig(armatures)…
and in the second case many rayCasts slow the engine…but in the end it is what I did…to be more clear I did use a rayCast…I would rather not though.
Then use a cube, place it below player, compound collisions, and put a collision sensor on it.
I like to work with a cube, a ray check just checks the center so standing on an edge can get you stuck.
Or you need to cast multiple rays from every corner a cube is nice and simple and does really well.
run this code on a controller of your character object (= physics type Character)
import bge
owner = bge.logic.getCurrentController().owner
character = bge.constraints.getCharacter(owner)
if character.onGround:
print("The character is on the ground")
else:
print("The character is in space")
OMG. I actually feel bad everytime I cannot figure something out for myself. I am however very thankful(vielen dank Monster…du kanst der engine sehr gut…my german is horrible )
and I would have never figured this out…
character = bge.constraints.getCharacter(owner)
I did understand I needed to access the physics controller…just no idea how…I thought it would be part of the owner
I would have needed to know to look in constraints first as well…sometimes you need to know the answer before you can ask
the question…
I was trying to find the link to pyObjectPlus…and it is very relevant…the more I can help myself the better.