Bounds are _not_ working for me.

I have an TransformGroup to which I give a BoundingSphere. In the game, the TransformGroup moves and rotates. I used setShowBounds on it and the bounding sphere I see doesn’t really move with it. First of all, I should say that it doesn’t matter what radius I specify the bounds (even 0), it starts out huge. Whenever the transformgroup rotates the boundingsphere moves up and down (or increases in size). Also, as the transform group moves along the negative z axis, the bounding sphere moves down (goes up the Y axis), or reduces in size.

Setting the bounds center and radius to the coordinates of the TG whenever it moves changes nothing, it still behaves the same way. And so the way it looks is that though the sphere moves, it doesn’t move the with the TG.

I think this may be a bug in Xith? In my coordinate system I have the netagive Y axis as up (out of the screen), the positive Z axis as … up (towards the top of the screen), and the positive X axis as right. (The view is looking down at the XZ plane with the positive Z axis as up).

What’s going on? I’m probably not doing something correctly…

Edit: BTW, the view moves with the TG, I think this could be causing the problem for some reason.

Edit: Ok, when adding bounds to some stationary objects they too are weird. They are stationary “with the view”. So as the view moves with the TG, the stationary bounds show up only when the actual objects are in the vicinity, and they move only with the view, they don’t stay in their place in space.

Here’s a screenshot of what’s happening (using latest CVS btw):

http://www.kinostudios.com/images/bug.jpg

The bounds exist, but they only show up when the view comes near the planets, and they are in the wrong place (to the upperleft and above the planets), and they move with the view.

The third bounding sphere you see there is the ship’s bounding sphere, and it moves all over the place like described in the first post.

Come now, surely somebody else is experiencing this problem? Bounds are rather important aren’t they?

Edit: here is some code if it helps:

Transform3D tf = new Transform3D();
                  tf.rotXYZ(FastMath.randomFloat(),FastMath.randomFloat(),FastMath.randomFloat());
                  tf.setTranslation(new Vector3f(x, distback, z));
                  
                  TransformGroup tg = new TransformGroup();
                  
                  BoundingSphere bounds = new BoundingSphere(new Point3f(0,0,0), radius+100);
                  tg.setBounds(bounds);
                  tg.setShowBounds(true, true);
                  
                  tg.addChild(shape);
                  tg.setTransform(tf);
                  planets.addChild(tg);

That’s for adding the planets to the scenegraph. The path to the planets looks like this:
Main BranchGroup > planets > various TG’s containing the planets, with bounding sphere’s applied to the TG’s as seen above.

The path to the ship looks like this:
Main BG > shipbg > shipTG. The boundingsphere is applied to the shipTG.

Changing various things like adding extra branchgroups between the main BG and the ship and planet’s doesn’t work. And the weirdest thing of all that probably proves this is a bug and not my fault is that the bounding sphere’s of the planets show up only when the View is “in their region”, and they move with the View as if they were in a foreground now that was fixed (there are no forground nodes in this scenegraph and the view does not contain any children).

Edit: Also, I noticed that when I apply the bounds to the actual Shap3D object of the planets, whenever the view shows a planet, the whole render looks like it becomes “tinted” to a darker, almost reddish color… I have no idea why it’s doing this, all I know is that I’m getting really frustrated…

Edit: Oh come on… I just did a simple test with some simple code and even tried adding a BoundingBox to the thing. It still came out as a huge circle just like the one around the ship. Am I seriously the only one experiencing this problem?

Are bounds not important anymore or something?

I myself haven’t done anything with Bounds yet, but i know, that there’s something called Odejava that controlls collisions and stuff. Then you wouldn’t need to work with the bounds in xith3d.

Arne

Hi,

I did not use bounds rendering option for a long time but I will guess that the problem is in bounds rendering code, not in the bounds calculation.

Typically you do not need to add bounds manually, because of they are autocomputed by default, but you can control it yourself by setIgnoreBounds(…), setBoundsAutoCompute(…), setBounds(…) etc.

Yuri

P.S. If you really think this is a bug, please prepare a test case and file an issue so we can take a closer look to this.

[quote]Hi,

I did not use bounds rendering option for a long time but I will guess that the problem is in bounds rendering code, not in the bounds calculation.

Typically you do not need to add bounds manually, because of they are autocomputed by default, but you can control it yourself by setIgnoreBounds(…), setBoundsAutoCompute(…), setBounds(…) etc.

Yuri

P.S. If you really think this is a bug, please prepare a test case and file an issue so we can take a closer look to this.
[/quote]
Alright thanks for the conformation, how do I prepare a test case and file it…?

Hi,

As simple as possible, something like a test cases in com.xith3d.test package.

Then join dev.java.net if you are not a member yet, and request Observer or BetaTester role for Xith3D project. Then I will approve you and you will be able to file an issue with IssueZilla at dev.java.net.

After you file an issue, attach zipped test case with all necessary info (textures, .bat files, etc.) to the issue.

I know this is boring to do all this, but this will save a lot of time for others.

Yuri

[quote]Hi,

As simple as possible, something like a test cases in com.xith3d.test package.

Then join dev.java.net if you are not a member yet, and request Observer or BetaTester role for Xith3D project. Then I will approve you and you will be able to file an issue with IssueZilla at dev.java.net.

After you file an issue, attach zipped test case with all necessary info (textures, .bat files, etc.) to the issue.

I know this is boring to do all this, but this will save a lot of time for others.

Yuri
[/quote]
Alright thanks, I’ve submitted a request for the Observer.

Hi

I’ve got the same problem !!

And I think I know why the Bounds are not drawn correctly!! :o

In my scene I’ve got a view which I can move around. But when I move it the Bounds move with it - meaning they don’t stay with the objects they’re bounds for. So i got to the conclusion that the Bounds are somehow seperately drawn onto the Canvas and therefore don’t stay at their correct position. They should be, when the view is at (0|0|0).

Correct me if I’m wrong and just have done a simple mistake.

Arne

Correct me if I’m wrong, bounds are a deprecated package of Xith3D that was maintained by David Yazel.
The best solution now is to use Odejava, as a lot of peoples do.

sure - but how can I do picking with Odejava ?
I wanted to use the Bounds to reduce my picking in xith (first check if the ray intersects the Bounds, then get the triangles - this should reduce the amount of triangles to be tested)

Ok I don’t have to see the Bounds anymore - I fixed my problem. :slight_smile:

[quote]sure - but how can I do picking with Odejava ?
I wanted to use the Bounds to reduce my picking in xith (first check if the ray intersects the Bounds, then get the triangles - this should reduce the amount of triangles to be tested)
[/quote]
If your Odejava geoms and body are linked with Xith3D geoms and shapes, this works same as pure Xith3D, I think.
I use Odejava, but I don’t began to test picking yet.