On or off ground

Can anyone inform me of another way to check if your on the ground or not the way i'm using seems to be inaccurate



SyntheticButton collButton = feetNode.getCollisionEventHandler();
           contactDetect.addAction( new InputAction() {              
               public void performAction( InputActionEvent evt ) {
                   ContactInfo contactInfo = (ContactInfo) evt.getTriggerData();
                   Vector3f vec = contactInfo.getContactNormal(null);
                   if (vec.dot(Vector3f.UNIT_Y) > 1f){
                       offGround = true;
                   }
                   Vector3f vel = contactInfo.getContactVelocity(null);
                   if (vel.length() > 10){
                       System.out.println("POWERFUL CONTACT: "+vel.length());
                   }
               }              
           }, collButton, false );      

hmm the current way seems even more inaccurate than i thought i can be 10 meters off the floor and it doesn't register…

maybe you can shoot a ray from your character down and check the distance that way

Core-Dump said:

maybe you can shoot a ray from your character down and check the distance that way


hmm i've never really had any use for it until now t shouldn't affect performance at all correct and i set it up and went through the class but how can i detect if it hits a surface? I would have to set up my test plane differently?


I've done HelloMousePick  :P