Terrain stuck again.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
raven_coda
Posts: 89
Joined: Thu Aug 17, 2006 8:11 pm
Location: Salt Lake City, UT, USA
Contact:

Terrain stuck again.

Post by raven_coda »

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.
Definition of an Upgrade: Take old bugs out, put new ones in.
gfxstyler
Posts: 222
Joined: Tue Apr 18, 2006 11:47 pm

Post by gfxstyler »

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
raven_coda
Posts: 89
Joined: Thu Aug 17, 2006 8:11 pm
Location: Salt Lake City, UT, USA
Contact:

Post by raven_coda »

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
Definition of an Upgrade: Take old bugs out, put new ones in.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

i thought the falling through the terrain thing was fixed way back in svn revision 45 (before irrlicht 1.1 was released). perhaps your gravity is too strong or something. can you post a code snippet that causes the problem?
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
raven_coda
Posts: 89
Joined: Thu Aug 17, 2006 8:11 pm
Location: Salt Lake City, UT, USA
Contact:

Post by raven_coda »

I'm not falling through just getting stuck. However, I can still post my part of my code when I get home tonight. From memory I can tell you my gravity is only -5
Definition of an Upgrade: Take old bugs out, put new ones in.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Falling through or getting stuck is often due to wrong heightmap size. You must use a terrain of size 129x129, otherwise problems will occur.
raven_coda
Posts: 89
Joined: Thu Aug 17, 2006 8:11 pm
Location: Salt Lake City, UT, USA
Contact:

Post by raven_coda »

That might well be my problem. The map I have is hugh! I think it's like 2048x256x3072!! So do I just scale everything down 25? Can you tell me why this is the case?
Definition of an Upgrade: Take old bugs out, put new ones in.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

3 dimensions :shock: 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.
raven_coda
Posts: 89
Joined: Thu Aug 17, 2006 8:11 pm
Location: Salt Lake City, UT, USA
Contact:

Post by raven_coda »

Ah... no I'm using a bsp not a hieght map. does this same bug apply to bsp files too?
Definition of an Upgrade: Take old bugs out, put new ones in.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

:lol: No, all things previously said by anyone here only applies to TerrainSceneNodes. It might be a general problem in your collision handling.
Rainbringer
Posts: 13
Joined: Sat Jul 01, 2006 3:14 pm
Location: Germany - Berlin

Post by Rainbringer »

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
raven_coda
Posts: 89
Joined: Thu Aug 17, 2006 8:11 pm
Location: Salt Lake City, UT, USA
Contact:

Post by raven_coda »

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:

Post by monkeycracks »

Mind posting the code of your fixed ellipsoid and stuff?
Rainbringer
Posts: 13
Joined: Sat Jul 01, 2006 3:14 pm
Location: Germany - Berlin

Post by Rainbringer »

ok, we fixed the problem.. it was not that big thing, just because we are nobbs in level programming we made two planes for each side (left/right) at the same positions, when we let some space between the walls the problem is fixed.. :?

Thankz!

mfg Rainbringer
Post Reply