Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (711)
Games in Android Showcase (213)
games submitted by our members
Games in WIP (785)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Bounding box position not updating?  (Read 1418 times)
0 Members and 1 Guest are viewing this topic.
Offline DAT64X

Senior Newbie

Java games rock!

« Posted 2003-04-16 02:20:12 »

I have a BoundingBox around an object and I'm drawing it graphically.  When I drag the object around, the BoundingBox moves with the object.  However, when I System.out.println(the bounding box), the lower and upper corner point locations never seem to change.  Are those points' coordinates relative to the center of the object?  How do I get the corner's positions relative to the axes?

Offline William

Junior Devvie

No Exit

« Reply #1 - Posted 2003-04-16 03:42:07 »

Your object probably sits below a TransformGroup in the scenegraph and movement is accomplished by changing the transform in the TransformGroup rather than changing the coordinates of your object.

All coordinates related to your object, including ones in other objects below your object in the scenegraph hierarchy, are relative to the TransformGroup's coordinate system. When you move your object, you are really just changing the location of the TransformGroup's coordinate system relative to the world coordinate system (at the top of the Java3D scenegraph). However, the relation that your object's coordinates have to TransformGroup's coordinate system stays the same which is why the coordinates of the boxes won't change.

You can think of your box as an object that lies in the trunk of a moving car. Its position relative to the car stays the same, but its position relative to the road changes as the car moves.

You can call the getLocalToVWorld method on your object to get a Transform3D that can transform your object's coordinates into the world's coordinate system.
Offline DAT64X

Senior Newbie

Java games rock!

« Reply #2 - Posted 2003-04-16 06:33:29 »

Hi, thanks for clearing that up.

However, I am confused as to how about getting for instance the lower and upper corner Point3ds of a bounding box in the virtual coordinate system.

For instance, if I had something like:
boundingBox = new BoundingBox();
boundingBox.setLower(-3.0, -3.0, -3.0);
boundingBox.setUpper(3.0, 3.0, 3.0);
boundingBoxLeaf = new BoundingLeaf(boundingBox);

I would be able to get the position of the boundingBox by saying
Vector3d pos = new Vector3d();
Transform3D T3D = new Transform3D();

However, that only gives me the position of the bounding leaf's center (correct me if I'm wrong) can I actually get the virtual world coordinate positions of the upper and lower corners of the bounding box within the bounding leaf?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline William

Junior Devvie

No Exit

« Reply #3 - Posted 2003-04-16 09:11:07 »

I think you should be able to do it by first getting the lower and upper corners of the box as points using the proper methods in the BoundingBox class and then transforming those points using the localToVworld transform of the box.
Offline DAT64X

Senior Newbie

Java games rock!

« Reply #4 - Posted 2003-04-16 12:35:05 »

Thanks, that worked!
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Archive (38 views)
2017-02-27 19:41:49

Riven (47 views)
2017-02-27 17:26:59

numerical (421 views)
2017-02-21 07:32:16

numerical (422 views)
2017-02-21 07:31:46

theagentd (536 views)
2017-02-18 13:42:33

theagentd (532 views)
2017-02-18 13:35:16

h.pernpeintner (1696 views)
2017-01-24 22:39:11

h.pernpeintner (1674 views)
2017-01-24 22:38:32

Galdo (2247 views)
2017-01-12 13:44:09

Archive (2180 views)
2017-01-02 05:31:41
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!