Walking

Currently to walk on the ground I use the flasgRush method below since i stopped using physics however due to the second if statements line this.getLocalTranslation().y-=gameSingleton.getStats().getFallRate(); when its on the floor it shakes up and down vigorously while moving.

2 questions

        1) Is their a quick solution to this.

        2) would it be better I cast 4 rays (down,right,left,front,back) since i was planning on having gaps, bridges

            and use bsp(doesn't have getheight())  you can walk udnerneath  etc

              a) if so can someone provide me with example code on how to use ray casting to level the character since

                  I was having issues with it in an earlier implementation

              b) currently though not directly all nodes whether scene or character is part of a node called MasterNode

                  which 2 nodes characterNodeHandler and sceneNodeHandler are attached to they have no

                 dependency and if i was to simply edit the line which attaches them to thier children the game would

                 still work.



      characterMinHeight = sceneManager.Manager().getTerrainHandler().getTerrain().getHeight(
            this.getLocalTranslation());  
        if (!Float.isInfinite(characterMinHeight) && !Float.isNaN(characterMinHeight)) {
           if(this.getLocalTranslation().getY()>=characterMinHeight)
              {this.getLocalTranslation().y-=gameSingleton.getStats().getFallRate();}
           else this.getLocalTranslation().setY(characterMinHeight);              
        }

          sceneManager.Manager().getTerrainHandler().getTerrain().getSurfaceNormal(
              this.getLocalTranslation(), normal);
        if(normal != null) {this.rotateUpTo(normal);}

i just told you this over AIM, but for the benefit of anyone else possibly having this problem, try setting the height of the minimum character differently… 


characterMinHeight = sceneManager.Manager().getTerrainHandler().getTerrain().getHeight(this.getLocalTranslation))+1f;



where 1f is the delta between your character and the terrain height

bah thx man i knew this was simple I was  coding all night and started drawing weird blanks lol thx man



btw can anyone assist with the ray casting



or at least confirm if i'm going in the right direction by



front=new Ray(this.getLocalTranslation(),this.getLocalRotation().getRotationColumn(0));
      back=new Ray(this.getLocalTranslation(),this.getLocalRotation().getRotationColumn(0).negate());
      left=new Ray(this.getLocalTranslation(),this.getLocalRotation().getRotationColumn(2).negate() );
      right=new Ray(this.getLocalTranslation(),this.getLocalRotation().getRotationColumn(2) );
      down=new Ray(this.getLocalTranslation(),this.getLocalRotation().getRotationColumn(2).negate() );

Usually front/back would be column 2, up down would be column 1 and left/right column 0.

through a lot of trial and error i think i have it down however when I move it, their are times the box goes through the floor. I attempted to change the ray direction vector from 0,-1,0 to 1,-1,0 and then move it again through the positive x axis however it still goes through hills.

I also attempted to gradually add .1 to the y translation if the distance was less than the yextent with no success



also is their a way i can find surface normal without using the terrainpage method for it?