terrain picking
terrain picking
how can i pierform terrain picking in irrlicht? i want to knw where in my terrain the user clicked like of those in an RTS game
hi spitz thanks for the reply
i have a followup question
a)using this i can get the coordinates of the area clicked on the terrain?
b)in using terrain rendering what are the exact coordinates of the terrain? i mean is the terrain centered at 0,0,0? or the terrain upper left coord starts at 0,0,0? or what?
thanks
i have a followup question
a)using this i can get the coordinates of the area clicked on the terrain?
b)in using terrain rendering what are the exact coordinates of the terrain? i mean is the terrain centered at 0,0,0? or the terrain upper left coord starts at 0,0,0? or what?
thanks
cool!
one last thing spintz,
Is there any limitation on the size of the terrain( or the heightmap) i can use/render? for example a heightmap bigger than 1024x1024? is there any culling in the terrain implementation in irrlicht thats culled away unnecessary vertices in the terrain?
ps. Sorry if i ask too much question coz my style in coding is i research some things before doing it and these question just pop my mind one at a time
one last thing spintz,
Is there any limitation on the size of the terrain( or the heightmap) i can use/render? for example a heightmap bigger than 1024x1024? is there any culling in the terrain implementation in irrlicht thats culled away unnecessary vertices in the terrain?
ps. Sorry if i ask too much question coz my style in coding is i research some things before doing it and these question just pop my mind one at a time
-
Guest
-
Crivens
You all do know, that the Terrain Example that ships with Irrlicht, scales the terrain, and the selector works just fine with it.
I've already posted my suggestions as to what the problem could possibly be. I've tested it, it works for me.
Unless code is given to look at, this is a non-issue for me.
I've already posted my suggestions as to what the problem could possibly be. I've tested it, it works for me.
Unless code is given to look at, this is a non-issue for me.

-
Fred
I see you're problem.
It's not the terrain, it's the Irrlicht collision. I'd seriously recommend using a physics engine, even just for basic collision. Irrlicht collision, obviously has bugs and is slower than any physics engine out there.
When TrueAxis first came out, it had a bug in it's own line tests when a line was parallel with the Y axis, or ran straight up and down. Irrlicht seems to have that bug, as well as others. I've modifed your code a bit -
http://pastebin.com/353607
I've added the triangle drawn on the terrain, similar to collision example 6. You'll notice with this code, many more boxes are placed on the terrain, that's because of this -
I'm forcing the line to be at an angle, instead of straight up and down, this works for the most part, but some boxes still aren't drawn on the terrain. You'll notice if you move around, the red triangle is always drawn on the terrain. However, check the console for locations where the collision filed ( I output them now ) and then restart, without calling any addObjects and set your camera position and target to the line start and end respectively( you can shrink the Y's ) and you'll see the triangle isn't drawn. Then move around a little bit ( side to side ) but stay focused on that area and eventually, the line test will start working.
This isn't the terrain, nothing I can do, post it in the Bug Forums for Niko to look at. I wish I could help more, but I don't have time to debug the Irrlicht collision code. It'd be much easier for you to just integrate into a physics engine, TrueAxis, Novodex, ODE, Newton, and there are most likely others to look into.
Sorry I couldn't help more!!!
It's not the terrain, it's the Irrlicht collision. I'd seriously recommend using a physics engine, even just for basic collision. Irrlicht collision, obviously has bugs and is slower than any physics engine out there.
When TrueAxis first came out, it had a bug in it's own line tests when a line was parallel with the Y axis, or ran straight up and down. Irrlicht seems to have that bug, as well as others. I've modifed your code a bit -
http://pastebin.com/353607
I've added the triangle drawn on the terrain, similar to collision example 6. You'll notice with this code, many more boxes are placed on the terrain, that's because of this -
Code: Select all
// Make sure the start.Y is higher than the highest point of your terrain
// Make sure the end.Y is lower than the lowest point of your terrain
myline.start = core::vector3df ( x + 100.0f, 2500.0f, z - 100.0f );
myline.end = core::vector3df ( x - 100.0f, -2500.0f, z + 100.0f );
This isn't the terrain, nothing I can do, post it in the Bug Forums for Niko to look at. I wish I could help more, but I don't have time to debug the Irrlicht collision code. It'd be much easier for you to just integrate into a physics engine, TrueAxis, Novodex, ODE, Newton, and there are most likely others to look into.
Sorry I couldn't help more!!!
