terrain picking
-
Fred
-
Fred
Not sure if this makes a difference, but in CSceneManager::getCollisionPoint, use this for a minor performance improvement, and I mean minor!:
Code: Select all
while (!found && i<cnt)
{
if (Triangles[i].getIntersectionWithLine(ray.start, linevect, intersection))
{
tmp = (f32)intersection.getDistanceFromSQ(ray.start);
tmp2 = (f32)intersection.getDistanceFromSQ(ray.end);
std::cout << "tmp = " << tmp << " " << "tmp2 = " << tmp2 << std::endl;
if (tmp < raylenght && tmp2 < raylenght &&
tmp < nearest)
{
nearest = tmp;
outTriangle = Triangles[i];
outIntersection = intersection;
found = true;
}
}
i++;
}
-
Fred
-
Fred
CTerrainTriangleSelector doesn't always return triangles The CTerrainTriangleSelector class doesn't always return triangles, when performing a selection using getCollisionPoint.
I think that the following is failing:
TrianglePatches.TrianglePatchArray.Box.intersectsWithLine(line)
This explains why objects placed using this mechanism aren't always placed on the terrain, but at a Y value of zero.
I think that the following is failing:
TrianglePatches.TrianglePatchArray.Box.intersectsWithLine(line)
This explains why objects placed using this mechanism aren't always placed on the terrain, but at a Y value of zero.
-
Fred
Well, I need your code then, to test that instance.
If you'd like, you can download my modifed irrlicht engine, Irrlicht-Spintz-0.12 from http://irrlicht.spintz.com/irrlicht-spintz-0.12.rar
There are precompiled DLL's and libs for Win32-VisualStudio, I have edited the DevC++ and makefile and they should work to build it if you need them, haven't tested them yet tho. Try out example1, it's not build, but is very easy to build. example1 is where i've been testing out these problems and it works perfectly there. Someone sent me a form of that code earlier and I got it working. If you're code doesn't work with my modified engine, then I'd definitely like to see youre code, to test further.
If you need help, I'm in IRC at irc.freenode.net in #irrlicht and #irrlichtnx or email me or just respond here again!
Just read through the thread again, and you're code is the code Example1 is based off of. It's working in my modified engine, I'll need to see what else is different, that's making it work, I might have an idea!.
Yeah, i was right, posted the fix to that in the thread you started in the Bug Reports forum, simple change. Triangles for the selector were being pulled from the base static vertex data, not the dynamic data, which holds the vertices with the transformations applied to them. Sorry I looked over that!
If you'd like, you can download my modifed irrlicht engine, Irrlicht-Spintz-0.12 from http://irrlicht.spintz.com/irrlicht-spintz-0.12.rar
There are precompiled DLL's and libs for Win32-VisualStudio, I have edited the DevC++ and makefile and they should work to build it if you need them, haven't tested them yet tho. Try out example1, it's not build, but is very easy to build. example1 is where i've been testing out these problems and it works perfectly there. Someone sent me a form of that code earlier and I got it working. If you're code doesn't work with my modified engine, then I'd definitely like to see youre code, to test further.
If you need help, I'm in IRC at irc.freenode.net in #irrlicht and #irrlichtnx or email me or just respond here again!
Just read through the thread again, and you're code is the code Example1 is based off of. It's working in my modified engine, I'll need to see what else is different, that's making it work, I might have an idea!.
Yeah, i was right, posted the fix to that in the thread you started in the Bug Reports forum, simple change. Triangles for the selector were being pulled from the base static vertex data, not the dynamic data, which holds the vertices with the transformations applied to them. Sorry I looked over that!
