Ox and 3D animated models

Feb 25, 2009 at 6:46 PM
Edited Feb 25, 2009 at 6:48 PM

I've just discovered this game engine and I'd like to use it to create my game.

Now, I'm trying to understand how to use Ox and I've started by modifying the scene associated with the GameDemo project, adding a 3D animated model (the hellknight) to it. After modifying the Scene.xml file through the SceneEditor, I can successfully load this scene with that model into the game, but I can't understand how to control the knight. I've written a little script to move and update it, to manage the camera, etc.; it's very similar to the ExamplePlayer script, but there must be something wrong, since I can't control the knight: it just stands still playing its "Idle" animation.
What should I use to successfully manage it? Maybe the JigLibX library isn't suited for animated models or simply I'm using the wrong classes (my script derives from [or implements?] the ComponentScript<ICSkeletonBaseComponent> script, but I don't know if this is correct... Moreover, I can't find the CSkeletonBase component in the latest Ox's release...).
I've noticed the XNAnimation project insied the Ox folder, but I haven't tried it yet: may this work to manage that animated model?

Thanks in advance.


P.S. Sorry for my bad English...
Feb 25, 2009 at 8:53 PM
Edited Feb 25, 2009 at 8:56 PM
Hi Sjallen!

I removed the ICSkeletonBaseComponent in the latest release. This is because it is far inferior to the ISkinnedModelComponent and it wasn't worth maintaining. ISkinnedModelComponent uses the XNAnimation system :) Therefore, you should definitely use the ISkinnedModelComponent instead.

Additionaly, you need to change the ScriptClass property of your player in the editor to match the name of your script class. The ScriptClass property needs the fully qualified name of your script class. The ScriptClass property is how Ox links your editor item to your script :)

BTW, documentation on using each editor is upcoming in the next release.

If you have any more problems, please post or send me your scene .xml and script .cs files and I'll take a look :)

- Bryan
Feb 25, 2009 at 10:17 PM
Hi Bryan,

thanks for your quick answer.

OK, so I'll use the ISkinnedModelComponent with the latest Ox's release from now on.
Anyway, I have still some problems. This time I'm using the PlayerMarine model: I've added it to my scene through the SceneEditor (am I wrong or the WASD keys to zoom on/off and rotate the camera are no more enabled?) and linked it to the script ExampleSkModel, which I've written just to manage this model and which I've added to the OxSolution\Ox\Scripts folder. Now, when I launch the game not only the marine won't walk/run (as it happened for the hellknight), but it falls down through the terrain, without stopping.
I think I had already tried to use the ISkinnedModelComponent with Ox's previous release (before resorting to the CSkeletonComponent), but I don't remember such problems; I wasn't able to move the marine around the area, but at least it would stand on the terrain.

I've uploaded my new .xml and .cs files to a free hosting service; here are the links to download them:

-scene.xml --> http://www.zshare.net/download/56177623880a54e4/
-ExampleSkModel.cs --> http://www.zshare.net/download/56177715e4811718/

For sure there's something wrong in the script, but I'm not able to find the problem...


Feb 26, 2009 at 7:48 AM
As to the scene editor controls, you are correct that WASD is now gone. It has been replaced by the middle mouse button used in combination with various modifer buttons (Ctrl, Shift, Ctrl+Shift). To "zoom", hold down the Shift button and drag the mouse downward. Try to get used to these controls as they are a big improvement. I am going to implement "zoom" with the mouse wheel on the next release.

As to what's gone wrong with your component and code...

Firstly, that script is for a ball that rolls on terrain. It's not meant to control a player character. Perhaps I should rename the script to PlayerBall or something...

You need to write your character script from scratch. Unfortunately, this means that you need character physics, which is not provided by JigLibX. So, you'd have extend JigLibX with a custom character physics class. This may be something that's above your skill level.

Also, your character component starts below terrain. Therefore it won't be on top of it :) Move it up on the Y-axis.

So... hmm... about the lack of JigLibX character physics. As my of Ox's users need character physics and I don't have time to extend JigLibX to provide them, I'm thinking about just removing JigLibX and throwing BEPU physics into my engine for the next release. If you don't want to wait, you can integrate BEPU yourself. But it depends if you want to take the time to figure out how to do that...

These issues are now top priority for Ox.
Feb 26, 2009 at 7:54 AM
On further thought, maybe I'll just include both physics engine in the next release. And it might be possible to get a reasonable character physics solution in JigLibX. Do a google on "jiglibx character physics" and see what you come up with.
Feb 26, 2009 at 9:50 AM
OK, no problem for the camera in the SceneEditor, I'll get used to using the mouse (what's more, it's very similar to the Blender's way to move the camera).

>> And it might be possible to get a reasonable character physics solution in JigLibX. Do a google on "jiglibx character physics" and see what you come up with.

OK, I'll try with that, but I was also thinking about something else: since what I want to do is quite simple (I'd like to load the marine model and move it around the scene), I was thinking about using directly the XNAnimation library in my script. I don't know if I'll be successful, I've never used it and it may not be easier to use than JigLibX or BEPU... I'll let you know what I'll be able to do with it.



Feb 26, 2009 at 10:16 PM
Hi Sjallen!

It's easy to just move the character around the scene. You just the component's LocalPosition property. If you want him to follow the terrain, you have to do queries on the terrain's height map to figure out where his Y should be. If you want to make him able to jump, then you can implement your own physics with simple gravity. But if you want him to be able to interact with pther physics objects (instead of just passing right through them), you'll need some sort of character physics solution. Fortunately...

We're working at JigLibX to come up with something that you can use out of the box. I'll keep you posted on the progress on that :)
May 20, 2009 at 4:58 PM

Has BEPU been added to the engine yet?

May 21, 2009 at 12:47 AM

Hi Matt!

BEPU is not and won't ever be added to Ox out-of-the-box. This is because BEPU is not free to license :(

JigLibX now, however, has a character physics starter example here - http://jiglibx.codeplex.com/Project/Download/FileDownload.aspx?DownloadId=64482.

So, JigLibX should now be adequate :D