Seregvan
20-07-2011 09:10:17
Found a bug in TerrainGroup::RayResult. When I call TerrainGroup::RayIntersects, it should return RayResult. but, it returns with bad values. I found out that in Ogre::TerrainGroup::rayIntersects there are a local variable
and then, when we pass it into Mogre, it automatically wraps by Mogre::TerrainGroup::RayResult, and it's pointer is stored there. And, because it was a local variable, the value becomes unexpected. So, I replaced default RayResult constructor from this
to this
I hope it might be usefull for someone![Smile :)]({SMILIES_PATH}/icon_smile.gif)
And second bug is that after build, my app crashed saying that "Cannot load Mogre.dll (Version=0.0.0) or one of it's depenencies...". So, the problem was that my Windows 7 is 64 bit, and Ogre and Mogre were compiled in 32 bit mode. So, after changing Target Platform of my c# app from Any CPU to x86, all works fine.
RayResult result(false, 0, Vector3::ZERO);
and then, when we pass it into Mogre, it automatically wraps by Mogre::TerrainGroup::RayResult, and it's pointer is stored there. And, because it was a local variable, the value becomes unexpected. So, I replaced default RayResult constructor from this
RayResult( Ogre::TerrainGroup::RayResult* obj ) : _native(obj), _createdByCLR(false) {}
to this
RayResult( Ogre::TerrainGroup::RayResult* obj ) : _native( new Ogre::TerrainGroup::RayResult(obj->hit, obj->terrain, obj->position)), _createdByCLR(true) {}
I hope it might be usefull for someone
![Smile :)]({SMILIES_PATH}/icon_smile.gif)
And second bug is that after build, my app crashed saying that "Cannot load Mogre.dll (Version=0.0.0) or one of it's depenencies...". So, the problem was that my Windows 7 is 64 bit, and Ogre and Mogre were compiled in 32 bit mode. So, after changing Target Platform of my c# app from Any CPU to x86, all works fine.