Some bugs found

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

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 :)

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.

Beauty

27-07-2011 20:30:01

Hi Seregvan,

thank you very much for your bug report and solution.
I will add it to the bug tracker and hope a maintainer will update the code and binaries.

The "newcomer problem" with Any CPU and x86 is known for a long time.
If somebody uses the precompiled binaries in an own project, then x86 settings have to be used (because the binaries were build for x86). So in my eyes it's no real bug. It's "just" a wrong project setting. However - it bothers people who doesn't know. By default new VS projects have "Any CPU" as default build value.

Did you use the precompiled binaries in your project?
Or do you mean some configuration settings for the Mogre build process?