OgreDotNet C# Intermediate Tutorial 4 posted


24-04-2006 03:55:13

I posted intermediate tutorial 4.

CAVEAT: I had to make a small change to OgreRoot.i, reswig and recompile my ODN dlls because the OGRE tutorial uses this function:

mRoot::_setCurrentSceneManager(SceneManager sm);

and _setCurrentSceneManager( SceneManager sm) has an entry
%ignore _setCurrentSceneManager
in OgreRoot.i

if you want to use this tutorial with the current code base, you'll have to remove that ignore line and reswig and recompile too.

my hope is that there is another way to do what _setCurrentSceneManager does that doesn't require recompiling ODN.. if you know what it is, please update the tutorial and let everyone know here in this thread.


25-04-2006 00:09:13

I updated cvs last night (04-23-2006), removing that ignore.

I just want to say DigitalCyborg and ElectricBliss, you guys are doing a greate job converting the tutorials.


25-04-2006 19:01:25

Hi Rasta,

Thanks for the update. DC is the one spearheading the tutorials. I'm just following up behind with minor cleanup.

*And* I believe that there are still small fixes here and there that I might have missed... so if anyone sees a typo or mistake please feel free to fix 'em.

I've been inundated with ‘real’ work and haven’t had as much time as I’d like to work w/ odn… I’m hoping to get back soon…




26-04-2006 16:58:41

Can i have access to Wiki, so i can post converted VB.NET Tutorials? Or do i need to do this another way?


26-04-2006 17:43:55

Use your "Main Forum" login for the wiki.


26-04-2006 18:50:57

Thank You

Al Capique

27-04-2006 22:04:12

I followed the tutorial to try to pick a .mesh object but my RaySceneQuery.execute() returns a empty RaySceneQueryResult all the time.

Ray mouseRay = Jogo._Camera.GetCameraToViewportRay(e.X, e.Y);
Jogo._CollisionResult = Jogo._RaySceneQuery.execute();

It happens even when the cursor is right on a .mesh object (Actually I only test with .mesh objects).

I´m using a SceneType.Generic scene but I got the same result with a SceneType.ExteriorClose scene.

I´m using windows forms and my OgreDotNet.EventHandle doesn´t handle the mouse and keyboard inputs. The mouse location, captured with Panel Event and passed to GetCameraToViewportRay method, is allways in the viewport.

What can be wrong?


27-04-2006 22:31:45

if you aren't using the OgreDotNet event handlers, but are using a mouse click event on a windows form panel then the e.X and e.Y are returning int values while the GetCameraToViewportRay is expecting floats in the range [0,1].

so you need to divide the e.X and e.Y values by the size of your viewport/panel.

The following code is a example where the panel/viewport is 800x600 (you should really use the properties of the panel to find its size though rather than hard code them like here.

Ray mouseray=appl.camera.GetCameraToViewportRay((float) e.X/800,(float)e.Y/600);
RaySceneQueryResult result = appl.mRayQuery.execute();

Al Capique

27-04-2006 23:02:52

It works!!! :D
Thanks a lot.

I should read the documentation more but I would never think the problem could be in this method.