Trouble ConvexHull-Bodies to work properly

20 views
Skip to first unread message

rschwemm

unread,
Dec 9, 2010, 7:47:22 AM12/9/10
to jinngine
Hi!

I'm currently trying to integrate jinngine with my project. And so far
it is really great, so thanks for all the work!
But right now I'm somewhat stuck.

I have simple geometries loaded as sets of triangles. (I have also a
set of all vertices for that matter...) My idea was to throw these
vertices into new ConvexHull-Objects and be happy. But I must have
missed something, it does not work.

So my code looks a bit like this:

ConvexHull hull = new ConvexHull(verts);
Body body = new Body(name, hull);
this.scene.addBody(body);

And this works fine. I also add a GravityForce, which works fine as
well.
However, when The ConvexHull-Body collides with my floor (also a
ConvexHull, fixed), it gives me an exception:

java.lang.IllegalStateException: Geometry has NaN in its bounding box
valuescube1
at jinngine.collision.SAP2.sortAxis(Unknown Source)
at jinngine.collision.SAP2.run(Unknown Source)
at jinngine.physics.DefaultScene.tick(Unknown Source)
at myproject.plugins.JinngineAdapter.tick(JinngineAdapter.java:
90)

What happens in JinngineAdapter.java:90 is
scene.tick();
where "scene" is a DefaultScene(new SAP2(), new
NonsmoothNonlinearConjugateGradient(44), new
DisabledDeactivationPolicy()); as used in some of the examples.

I figure it has sth, to do with the bounding boxes. They are created
on the fly, right? Or should I try to export these as well with the
actual model? Or is it something else?

Every hint would be appreciated! And every hint concerning my use of
the English language as well. I'm not a native speaker ;-)

Thank you!
Roland

rschwemm

unread,
Dec 9, 2010, 9:44:11 AM12/9/10
to jinngine
Hi again!

I was able to trace it back to some of my Vector-Matrix-Conversions.
So this is probably not
a Jinngine issue. Sorry to bother you because of this. It is always a
pain to keep all the
different Math-Implementations and World-Models in sync.
Which brings me to another, related question:

Does Jinngine make assumptions on the coordinate system? I was unable
find documentation about this.
I had a brief look at the source, but it didn't jumped at me.

My current conversion assumes it to have:

up : y
right : x
out of screen : z

But I'm not sure if this is correct. The default gravity-direction
seems to be correct.

I would be glad to hear from you!
Roland

mo

unread,
Dec 9, 2010, 10:22:50 AM12/9/10
to jinngine
Nice to hear that you got it working. The gravity force assumes that
"down" is the negative y-axis. But it can easily be changed to work in
any direction you want. I think the convention that you describe is
the standard used by OpenGL for camera view space. But I guess this
convention is also often used for world-space coordinates. Of course,
in world space there aren't any notion of "right" or "out of screen"
in the XZ-plane, as it depends on the camera.

But the physics doesn't really care what is defined to be what
direction, as long as geometry is given in a flat cartesian space :) I
don't think a concept like handedness of a coordinate system will play
any role here, because when you specify points for a convex hull, the
quickhull algorithm will figure out what orientation the faces have,
in relation to a standard right-handed system.

Mo

rschwemm

unread,
Dec 9, 2010, 10:51:05 AM12/9/10
to jinngine
Thank you for the explanation. This sounds pretty straight forward (in
application).
As mentioned, the current behavior is still unexpected, but this could
very well be an issue with the way I visualize things. I'll dig into
it.
In case I stumble upon any further enlightenment, I' let you know ;-)

With best regards,
Roland
Reply all
Reply to author
Forward
0 new messages