private void buildVillage() {
//Create house
n2 = new Node("Node 2 for collision");
Village village1 = new Village();
village1.buildHouse("house1","Model/modelhouse.3ds");
village1.setLocalScale(1f);
village1.setLocalTranslation(new Vector3f(70,-1.83f,70));
scene.attachChild(village1);
It is possible to detect collisions with Spatial.findCollisions, handling collisions is more difficult, for that you need to consult HamsterofDeath who is an expert.
I think you will welcome a more higher level explanation (please ignore the post if all this is too obvious for you).
I supposse you are using one of the built-in controllers to move around.
Note that drawing models and geometry is different than actually interact with them.
To interact with your geometry, you need to handle all manually. This means that if you try, i.e., to make a character walk, you will need to define how width and tall your character is, and find whether it is colliding with your geometry.
A usual method to achieve this is to use a bounding box for your character, and use collitions to find if your character has collided with any of your object. If it did, you move it back to the last valid position (this is a really uncomplete method though).
However, what I have said applies to floor too.
So, how is your character standing on the floor? what are you doing to make it not able to go through it?
How are you moving your character (using a controller?)
A more advanced, but in the same time handy method of handling all this is to use a physic engine that manages collisions for you. A physic engine can make sure your objects never go through each other. However, start replying to the questions above so we can try to help you better.
It is possible to detect collisions with Spatial.findCollisions, handling collisions is more difficult, for that you need to consult HamsterofDeath who is an expert.
*happy happy joy joy*
there are several ways to solve collisions.
the easy and low budget way:
if there is a collision, reset the position of your character to its last one. this one is ugly. you might still get through walls on low framerates.
the acceptable way for non FPS games and solid walls (no small obstacles like chairs or non-solid-but-blocking-walls like a wall containing small holes:
shoot a ray in the direction you're heading. if there is a collision, reset your position to the intersection point between the ray and the world. i'm doing this to keep the fast moving projectiles in hhexen from beaming through walls.
the easy and "this feels right" way:
if you only use boxes (oriented or not), you just have to move your character along the boxes normal until it's outside. the calculation is quite simple - just check which way is the shortest, add a rotation in case you're using OBBs.
this way, if you run into a box, you'll slide along it's border, your speed depending on the angle. maybe this suits your needs.
the hamsterofdeath way:
collect all triangles the players bounding box is touching and move the player along their normals (shortest first, check for collisions again, repeat) until all collisions are handled. this *may* sound easy, but it's not ;)
there a lot of special cases, "player squished" detection, unsolvable situation detection, stair detection, not to mention special meshes like ladders and moving meshes like doors.