Terrain stuck again.
-
raven_coda
- Posts: 89
- Joined: Thu Aug 17, 2006 8:11 pm
- Location: Salt Lake City, UT, USA
- Contact:
Terrain stuck again.
I know the general solution for the problem of a node getting stuck on a terrain is use a physics engine but I feel it would be sad to add a physics engine just to cover this one item. It is currently the only reason I am using newton. Does anyone have a better solution? Large elipsods won't work for me as my node has to fit through tight spaces.
Why exactly is it getting stuck? Maybe I can do some research and help improve the irrlicht collisions. It would be worth it.
Why exactly is it getting stuck? Maybe I can do some research and help improve the irrlicht collisions. It would be worth it.
Definition of an Upgrade: Take old bugs out, put new ones in.
solution2: look into the bug thingy forum, spintz posted a function for "getHeight(x,y)" that you can use with terrains.
that way you dont have to use the animator (which lets the node fall thru the terrain).
solution3: do the same with rays from the node to the terrain (but i think spintz's method is faster)
in general it's like this:
get the node position (node has to be above the terrain)
shoot a ray from the node position down to the terrain (actually, under the terrain, this can be -100 of your terrain is at 0 for example)
the result will be the correct position on the terrain, set your node-position to that one.
done
that way you dont have to use the animator (which lets the node fall thru the terrain).
solution3: do the same with rays from the node to the terrain (but i think spintz's method is faster)
in general it's like this:
get the node position (node has to be above the terrain)
shoot a ray from the node position down to the terrain (actually, under the terrain, this can be -100 of your terrain is at 0 for example)
the result will be the correct position on the terrain, set your node-position to that one.
done
-
raven_coda
- Posts: 89
- Joined: Thu Aug 17, 2006 8:11 pm
- Location: Salt Lake City, UT, USA
- Contact:
Thanks for the feed back.
That thought had crossed my mind however if my terrain has any cliffs in it (which it does) then the node instantly climbs the cliffs no matter how high they are. This is not quite what we are after. This could be over come by checking if the change in Y is > then desired. I would also do a check if Y< whatever gravity is so that it doesn't snap to the ground when jumping off a ledge.
Finnally I would still need to have collisions on for the object so it doesn't go stright through vertical walls.
In the end I guess that idea is the best presented so far. I have been reading through the code for collisions and gravity to understand it better and may just make my changes in the irrlicht scorce code as I think that's where it would be long. Right now I'm reading the Paper on which niko based his Collisondresponce code on. If I find something intresting I'll post it here if not then I'll post what I end up doing.
I've already found one flaw. From what I can tell It seems the code for collisons doesn't take into count the rotation of the node. ie say you set your ellipsode for a node to (10, 30, 20) then if it rotates the ellipsode doesn't to match. This isn't my problem but I'm wondering what else I'll find
That thought had crossed my mind however if my terrain has any cliffs in it (which it does) then the node instantly climbs the cliffs no matter how high they are. This is not quite what we are after. This could be over come by checking if the change in Y is > then desired. I would also do a check if Y< whatever gravity is so that it doesn't snap to the ground when jumping off a ledge.
Finnally I would still need to have collisions on for the object so it doesn't go stright through vertical walls.
In the end I guess that idea is the best presented so far. I have been reading through the code for collisions and gravity to understand it better and may just make my changes in the irrlicht scorce code as I think that's where it would be long. Right now I'm reading the Paper on which niko based his Collisondresponce code on. If I find something intresting I'll post it here if not then I'll post what I end up doing.
I've already found one flaw. From what I can tell It seems the code for collisons doesn't take into count the rotation of the node. ie say you set your ellipsode for a node to (10, 30, 20) then if it rotates the ellipsode doesn't to match. This isn't my problem but I'm wondering what else I'll find
Definition of an Upgrade: Take old bugs out, put new ones in.
-
raven_coda
- Posts: 89
- Joined: Thu Aug 17, 2006 8:11 pm
- Location: Salt Lake City, UT, USA
- Contact:
-
raven_coda
- Posts: 89
- Joined: Thu Aug 17, 2006 8:11 pm
- Location: Salt Lake City, UT, USA
- Contact:
-
hybrid
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
3 dimensions
The heightmap should be 129x129 pixels large (and 256 colors if you meant that). The scaling afterwards is arbitrary and does not change the number of vertices.
You can use your heightmap and scale it in a graphics tool such as gimp. Or split it into several terrains which are dynamically enabled and disabled based on the camera position.
You can use your heightmap and scale it in a graphics tool such as gimp. Or split it into several terrains which are dynamically enabled and disabled based on the camera position.
-
raven_coda
- Posts: 89
- Joined: Thu Aug 17, 2006 8:11 pm
- Location: Salt Lake City, UT, USA
- Contact:
-
Rainbringer
- Posts: 13
- Joined: Sat Jul 01, 2006 3:14 pm
- Location: Germany - Berlin
I've got the same problem with my 3ds map, i stuck in some of the corners, and sometimes at the ground... is there any known bug? How do other people handle their collision? i tried to fix the problem with other settings for the slidingValue, the ellispoid translation,... then it was partly better, no real succes...
could it be that there is no problem with in irrlicht or in the program (because the collision tutorial works very similar to my project), but with the 3d models of our maps?
mfg Rainbringer
could it be that there is no problem with in irrlicht or in the program (because the collision tutorial works very similar to my project), but with the 3d models of our maps?
mfg Rainbringer
-
raven_coda
- Posts: 89
- Joined: Thu Aug 17, 2006 8:11 pm
- Location: Salt Lake City, UT, USA
- Contact:
I solved my problem by reducing the ellipsoid to a small circle. Not exactly sure why this fixed it. Try playing with you ellipsoid, gravity and friction until the stuck problem gets better. Just out of curiosity how what is you terrain? Mine is a bsp map made from gtkRadiant.
Definition of an Upgrade: Take old bugs out, put new ones in.
-
monkeycracks
- Posts: 1029
- Joined: Thu Apr 06, 2006 12:45 am
- Location: Tennesee, USA
- Contact:
-
Rainbringer
- Posts: 13
- Joined: Sat Jul 01, 2006 3:14 pm
- Location: Germany - Berlin