[OdeJava] Example with Xith - More simplistic

I apologize for having to ask this, but after taking a lot of time and learning Xith, which was relatively painless after going through the tutorials and playing around wth all the example code, I am trying to learn OdeJava to utilize the collision detection and physics but am having a difficult time as all the links to a tutorial are for the old version of the forum that no longer seems to exist anymore. If someone could give me a bit of very simple sample code that simply creates two objects and applies the OdeJava physics and collision system to them it would be very useful to me, but would be very useful to a lot of other people I think as well.

I have gone through the Car example and there’s just so much junk being referenced in so many different classes it’s extremely difficult to put it all together and understand exactly what is happening. I want just a single class that functionally applies physics and collision detection. I’m assuming it’s not that complicated for someone capable of doing it. If this isn’t true then perhaps I should be writing my own physics and collision system instead of using Ode.

Finally, a lot of the sample code I’ve seen in the forums are not actually even functional, they reference object names of things that I’m assuming used to exist but no longer do.

Thank you,

Matthew D. Hicks

http://odejava.org/showsrc.php?src=src/org/odejava/test/simple/HighLevelApiExample.java

NewbTon,

I took a look at that one already, I guess I need to look at it further, but it doesn’t show anything graphically for me. It just steps through and then exits. I’ll look at the way the code works though and hopefully be able to figure out how to apply this.

Thanks,

Matt

Theres nothing “graphically” in ODE. You create your bodies and geometry,
read their positions during steps, then copy the values over to their graphical counterpart which can be anything.
Once you understand ODE which is not very difficult you will understand what I mean.

Well, I’ve been looking at the sample code some more and it looks like there are two ways to work with Ode and Xith. Either build your Xith scene and generate Ode objects based on them, or generate your Ode objects and generate your Xith scene from it. My question is, which way is the better way to go?

Thanks

Generate ODE objects and create your XIth objects from them
Personally I have an object that binds those two, something like :


interface INode {
  public void setPosition();
  public void setRotation();
 }

Class OdeNode {
   INode node;//could be anything
   Body body; //ode
 public void update() {
    node.setPosition(body.getPosition());
    node.setRotation(body.getRotation());
   }
}

Just make different implementations of INode and your ODE specific code will never be mixed up with your rendering code.
So if you want to switch to some other rendering API you can do it in 10 minutes (or in a matter of days still its very fast)

I appreciate all your advice, I was thinking about doing that actually. I don’t suppose your code is available so I can get some ideas of how to best implement this?

In fact, drop me an e-mail if you’d be interested in possibly working on some projects together: darkfrog@pyramex.com

Thanks,

Matt

Hey Sunsett right now I dont have much time other than for my own little project. but maybe later on.
There’s so much to do on that I just can’t do anything else.
If you looked at my code right now it would probably confuse you totally it still confuses me !
The basic idea is what I wrote before. And to make it easier on yourself abstract everything that has to do
with graphics.
I dont understand why you dont see many doing that since all scenegraphs basically have the same interface.

Perhaps I could be of some assistance? If you’re not looking for any help I understand, but I’m a professional Java developer that’s trying to pick up game development and I’m having a difficult time. I’m a very good coder though. I was just thinking that I might be able to help you with your project and in turn you might help me smooth to path to learning 3d game design.

Either way I appreciate your willingness to help. For anyone else that is having the same problems I’ve been having, I’ve attached an example source that combines the Ode and Xith code into one class for the “SimpleExample” / “HighLevelApiExample”. I’ve found this very beneficial to understanding how they work together and thought it could be beneficial. I’ve commented which sections go to which technology.

You’ll also need the “groundandtrees3.png” file that is included in the OdeJava download. You’ll just have to put that in your default directory or register another Texture path.

Thanks,

Matt

Something else I’m not quite sure how I would do in Ode. I’m using ASE models in my project and I would like to add collision detection and physics to them, but not sure how I would do that from Ode? Is this one case where it makes more sense to build my Xith object and then determine the bounding sphere around it and define that for Ode?

Thanks,

Matt

hi Matt

thanks a lot for your help
however i got an error when i tried to compile your attached file
here is the error
C:\Documents and Settings\mali\Desktop\New Folder\CopyOfOde2XithTest2.java:114: cannot resolve symbol
symbol : variable TestUtils
location: class CopyOfOde2XithTest2
geom = TestUtils.createQuad(
^
1 error

Tool completed with exit code 1