XNA and Havok

XNA and Havok

Imagen de lmdave

Has anyone started thinking about attempting to incorporate Havok into the XNA/C# platform? I've done some work in the past incorporating C++ unmanaged dlls into a Managed DirectX (C#)project, so I imagine it would be feasible.


My strategy would probably be to create a C++ dll wrapping the desired functionality of the Havok API, and then have that DLL directly communicate with Havok, trying to keep thedata to be transfered between C# and C++ as minimal as possible.

publicaciones de 13 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.
Imagen de Sorlaize

Yeah, I am going to implement Havok in XNA with all the other mashed up parts from examples =p. I noticed a blog post about Havok hiring a c# programmer, so I think the free release may be targeting XNA'ers. Could you explain how this would be done (e.g. adding to the solution, build parameters and such)? I'm currently leading a non-commercial MMO project using XNA to produce the game by doing a lot of design work and not spending time on getting the framework of the engine together. If you're offering help to someone, our project hasn't got a lot of members =D

Imagen de benny53

Hah, I already have started working on one :P It still has a ways to go, but I got basic rigid body implementation done. Also, sorlaize, if you wanna help, that'd be great, because porting Havok all by myself is quite a feat. Email me if you'd like to help out, because this is something quite interesting, and I want to bring commercial quality physics to xna. Mainly, right now, I have to tighten up rigid body physics encorporated in XNA, but other than that, everything else will be easy. So yup, if anyone would like to help, I'm open for it :)

Imagen de Sorlaize

Of course I'd like to help =D

What is your email benny? You can email me or add on msn, sorlaize@live.com.

Imagen de benny53

My email is bben53@gmail.com. I'm installing MSN messenger as of right now, so I'll contact you shortly

Also, LMDave, if you'd like to help as well, that'd be great, because the more help I have, the quicker it gets done.

I have a basic roadmap for all the releases, and when I get the actual physics tightened and working correctly, then it'll be smooth sailing from then on out. I'm also thinking we'll have to create a custom content processor for generating a VertexPool I'll use in the XnaHavok library, which will then create a triangle mesh shape ( although, it says that is deprecated, so I'll be looking in the docs for another class ). I'm also thinking, since XNA units and Havok units are quite different, that I'll have to calculate Havok rigid bodies ( at least for primitives ) based on the Bounding Boxes of objects, or Bounding Spheres.

Imagen de ghornmoen

Hi Lads,


I am also planning on using Havok with a managed C++ wrapper for use in C#/XNA. While I can't commit to any schedules I'd be happy to contribute anything I am able to produce to your efforts. For me, rigid body support and basic animation would be the first areas I'll be digging into (once I get the framwork up and running and I'm able to attach the visual debugger to the XNA app).


George

Imagen de benny53

I have basic rigid body support for now. Really, its a matter of converting all the units, because while Havok uses the metric system, I have no clue what xna uses. So its a bit difficult to convert between the two. So its that or get xna to use the metric system. Otherwise I have havok working as of right now.

Imagen de lmdave

Sounds like a good start!


I'll be happy to help out if I could be of use.

Imagen de bigbearscot

It is a good plan, there a couple of issues of course.

  • If you write a manged wrapper around some of Havok API then it will only work on the PC platform it will probably not work on the 360, as on the 360 you can only access managed dlls(please correct me if I am wrong)
  • When creating a managed wrapper it is often a good idea to carry out some refactoring. This simplifies the API for other programmers, I would recommend that before any coding is done some design should be carried out.

I created my own Game Engine using Ogre, and I wrote a managed wrapper around my main unmanaged game dll so that I could build an Editor using WinForms and C#. The initial task I carried out was to wrap the functionality of the unmanaged dll, this involved some refactoring of the managed C++ code. Also another big task was the marshalling of unmanaged types to managed types.

benny53: I have basic rigid body support for now. Really,
its a matter of converting all the units, because while Havok uses the
metric system, I have no clue what xna uses. So its a bit difficult to
convert between the two. So its that or get xna to use the metric
system. Otherwise I have havok working as of right now.



I am sure XNA is unit agnostic, it is up to the programmer to decide the units for XNA/Havok as long as remain consistent between the two then there should be no real issue.

I would be willing to help but my time may be limited over the coming month. I will watch this thread with interest and may pitch in if need.

Good luck






Imagen de benny53

BigBearScot,
Yes, about the units, I figured that out while messing around with all the stuff. Turns out I was just being dumb. I figured out everything, and it works in C# for the most part. I mean, I still have a ways to go, but I can have basic physics in right now. I'm working on triangle meshes very soon here, so then it'll be at very least able to simulate basic physical situations. Then my next target is probably going to be joints, and then move on from there. But thanks for the tips. I have plenty of help as it is, so I wouldn't really need much more anyways. I can't think of anything that is even giving me trouble, I'm just implementing from here on out really. The most difficult, that I can forsee at least, is animation implementation, but even that won't be to difficult, since I know how I'll manage that. But thanks again.

Imagen de benny53

Oh, also, BigBearScot, I am using static libraries for the managed dll. So it may run on the 360 ( if I understand you correctly that is ). I would test it, but sadly, I have no xbox 360 or creators club account. So, that'll have to wait until I can get a, hopefully free from some contest or something, creators club membership. I would buy one, but I'm afraid without an xbox 360 there is not much I could do with it, because I'm going to be using RakNet for networking, not Xnas built in networking.

Imagen de havokmarc

> I am sure XNA is unit agnostic, it is up to the programmer
> to decide
the units for XNA/Havok as long as remain consistent
> between the two
then there should be no real issue.

You should model object in Havok in meters, using real world scale. This should work for most situations. You might need to take special care to get the behaviour correct for very small objects (smaller than a coke-can, say).

Imagen de benny53

Yeah, my wrapper is basically just a .NET port of Havok ( just accepts Xna Vectors and Quaternions ). It will use Havoks meter scale. I fixed all problems with the units though, mainly because there weren't any and I was making it harder than it really was.

Inicie sesión para dejar un comentario.