Collision walk up walls

This is a little further off but how would i prevent objects from jumping to the top of a wall using the initial code below is thier a way to check for the rotation of the wall and prevent it if it larger than a certain degrees relative to the player?





//make sure that if the player left the level we don't crash. When we add collisions,
        //the fence will do its job and keep the player inside.
           characterMinHeight = gameSingleton.get().getCurrentBlock().getHeight(getRootNode()
              .getLocalTranslation());  
        if (!Float.isInfinite(characterMinHeight) && !Float.isNaN(characterMinHeight)) {           
            getRootNode().getLocalTranslation().setY(characterMinHeight);              
        }
        
   //get the normal of the terrain at our current location. We then apply it to the up vector of the player.
        gameSingleton.get().getCurrentBlock().getSurfaceNormal(getRootNode().getLocalTranslation(), normal);
        if(normal != null) {
           getRootNode().rotateUpTo(normal);
        }   

My suggestion would be that you use different ray picks.  set on the the player's origin and the others a bit further in the direction the player is heading. both rays should direct right on the floor (0,-1,0). Then you check both distances and if the difference is too huge refuse to walk on.

Nevertheless a chracter should come so far that it jumps on a wall!? For that you could

use another pick. Dealing with the angles seems a bit too complicated for me…



Maybe that helps a bit.

http://www.idsoftware.com/business/techdownloads/



I think everyone who writes his first character controller for a 3d game can learn a lot from the Quake 3 Arena soucecode. It is C but very clean, structured and has many useful comments.

So,…as it seems you read it already you can give a brief summary how quake3-arena is doing it!?

Nevertheless thx for the link…never can have enough input.

ahh yes thx for the link i remember u suggested me looking at the Quake 3 source @ one point… i'll look at it now that i know C++ a little better however a if u do have time a brief summary would be appreciated.

Ok… so let

JackNeil said:

When you want more than a rectangular fence around your level I would suggest BoundingBoxes.


hmm i was planning on using heightmaps to keep things simple at the current moment and i don't really think I can create separate bounds for walls and floor that way. However, since i'm no longer using the physics impl again maybe i can go back to my original bsp level design would that be better for this situation?

thx for all the help btw...

Oh… your "walls" should be steep planes of the terrain?

Then I was a bit irritated because in your code you write something about a fence.



In this case I would reduce the initial speed of the player by a factor that depends on the dot-product of initial speed and the terrain-normal.

This method would allow the effect, that you can run downwards faster and upwards slower. But you can of course use a threshold to have only normal-speed and stopped.



Another option would be to make one short ray-check against the terrain in the direction you want to move and check if you have an intersection. When there is an intersection stop the player. When not, let him move.

Your paramters would be the length of the ray and the height of the origin of the ray.

JackNeil said:

Oh.. your "walls" should be steep planes of the terrain?
Then I was a bit irritated because in your code you write something about a fence.

In this case I would reduce the initial speed of the player by a factor that depends on the dot-product of initial speed and the terrain-normal.
This method would allow the effect, that you can run downwards faster and upwards slower. But you can of course use a threshold to have only normal-speed and stopped.

Another option would be to make one short ray-check against the terrain in the direction you want to move and check if you have an intersection. When there is an intersection stop the player. When not, let him move.
Your paramters would be the length of the ray and the height of the origin of the ray.



my mistake about the fence thing, when i was originally writing the class i was having issues so i copied that section from the flag rush tut though i later found that wasn't the part that was giving the issue i never changed it back thus the comments stayed with it.

As for the impl u would suggest that i get the normal as well as the accelerated speed of the player and depending on the magnitude of the normal I slow the speed of the player accordingly I would then create an if clause before the initial approach and set a threshold to prevent the player from scaling up walls correct

one question wouldn't this make pathfinding more difficult to impliment?