Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (541)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
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  
  [odejava] GeomTransform broken?  (Read 1724 times)
0 Members and 1 Guest are viewing this topic.
Offline frdfsnlght

Senior Newbie




Trying to understand


« Posted 2004-05-26 00:10:45 »

I'm trying to use one aspect of the new multi-geom support. Specifically, I'm trying to add a single Geom to a body where the Geom's center does not coincide with the body's reference point. I started with code like this:

1  
chassisBody.addGeom(new GeomBox(CHASSIS_WIDTH, CHASSIS_HEIGHT, CHASSIS_DEPTH));


And that works as expected. I then changed it to offset the geom relative to the body:

1  
2  
3  
4  
5  
g = new GeomBox(CHASSIS_WIDTH, CHASSIS_HEIGHT, CHASSIS_DEPTH);
g.setPosition(V_CHASSIS_OFFSET);
gt = new GeomTransform("chassisTransform");
gt.setEncapsulatedGeom(g);
chassisBody.addGeom(gt);


But when I run the sim, the chassis body immediately disappears from view. I haven't tried to track it down, but maybe it's falling through the Trimesh terrain. This is also the behavior when V_CHASSIS_OFFSET is a zero vector (0, 0, 0), which I would expect to behave exactly as if there was no GeomTransform, just like the first code block.

Am I doing something wrong? I believe I'm doing things as the ODE docs say, but maybe I missed something.

-Tab
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #1 - Posted 2004-05-26 07:45:01 »

I assume you've read: http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=physics;action=display;num=1082775578

The only thing I can see that I did differently is that I set the position of the encapsulated geom AFTER encapuslating it.

ODE's very procedual at times and likes things in the correct order - maybe that's it.

try:
1  
2  
3  
4  
5  
6  
g = new GeomBox(CHASSIS_WIDTH, CHASSIS_HEIGHT, CHASSIS_DEPTH);
gt = new GeomTransform("chassisTransform");
gt.setEncapsulatedGeom(g);
chassisBody.addGeom(gt);

g.setPosition(V_CHASSIS_OFFSET);


Will.

Offline frdfsnlght

Senior Newbie




Trying to understand


« Reply #2 - Posted 2004-05-26 12:31:16 »

Yes I did see the post you refered to, but had forgotten about it :-/

I'll try changing the order of the statements. Thanks for the tip.

-Tab
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline frdfsnlght

Senior Newbie




Trying to understand


« Reply #3 - Posted 2004-05-26 14:03:43 »

Changing the order as you suggested didn't help; same problem. However, I have discovered that my model isn't simply falling through the terrain, but is getting totally dislocated from reality:

1  
2  
location: (-1.0, 50.0, -1.0)
location: (NaN, NaN, NaN)


That's output from my app for each frame. Each line of output is before I call stepFast. The first line indicates my body's location as I set it before I run the sim. The second line shows the body's location after ODE gets done with it. And that's the last line of output. No additional frames are rendered and it seems the whole Java3D render loop is stuck (trying to render an object that is "nowhere"?).

When I revert to my previous code (i.e., no GeomTransform), I get normal output:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
location: (-1.0, 50.0, -1.0)
location: (-1.0, 49.720078, -1.0)
location: (-1.0, 49.613567, -1.0)
location: (-1.0, 49.488773, -1.0)
location: (-0.9878979, 49.206493, -1.0057374)
location: (-0.9750137, 49.111187, -1.0105658)
location: (-0.95794374, 49.023903, -1.0157655)
location: (-0.94674605, 48.94492, -1.0238384)
location: (-0.9331251, 48.95429, -1.0324804)
location: (-0.92429227, 48.981445, -1.0410043)
...


As you can see, the sim runs and the body can be seen to fall under gravity's influence until it collides with the terrain at about y=49.3, then it bounces a bit and life goes on.

I can't figure out what's wrong. I'm willing to try to build a test case, but that would be a horrendous task starting from my current code base. In the test you displayed in the other post, did you have gravity?

-Tab
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #4 - Posted 2004-05-27 02:29:44 »

I've got the NaN (means "Not a Number" FYI) issue before and it's a pain.

Can you run my multi-geom/encapsulated-geom demo?  If so, can you try and mimick my code?  Try running org.odejava.test.simple.MultiGeomTest (you'll need to run it though a harness - either the Xith3D class RunDemo or your own implementation of RunDemo).

I run :
1  
java -cp xith3d.jar:odejava-xith3d.jar:../odejava/odejava.jar org.odejava.xith3d.test.RunDemo org.odejava.test.simple.MultiGeomTest


That code works great for me.  I have seen your issue before though - I think ODE just needs things in the correct order.  It's VERY important to make backups/use version control with this I find, being able to roll back to the last working version is essentiall!

Will.

Offline frdfsnlght

Senior Newbie




Trying to understand


« Reply #5 - Posted 2004-05-28 19:37:23 »

No luck yet. I've run the demo and it works as expected. My code is doing exactly what yours is, in the same order. I'm still scratching my head.

I'll try to reduce my code to the bare minimum while reproducing my problem. I have no idea how long this will take because some real life is intruding on my play time. I'll update when I get something. Thanks.

-Tab
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #6 - Posted 2004-05-29 23:09:58 »

ok, a test case would be good, we can try and work through the problem.

It's annoying, but I sometimes have similar non-deterministic behaviour from ODE/Odejava (in other words some times it just doesn't work for no reason).

Will.

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

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Mr.CodeIt (10 views)
2014-12-27 04:03:04

TheDudeFromCI (15 views)
2014-12-27 02:14:49

Mr.CodeIt (25 views)
2014-12-23 03:34:11

rwatson462 (56 views)
2014-12-15 09:26:44

Mr.CodeIt (46 views)
2014-12-14 19:50:38

BurntPizza (92 views)
2014-12-09 22:41:13

BurntPizza (113 views)
2014-12-08 04:46:31

JscottyBieshaar (86 views)
2014-12-05 12:39:02

SHC (96 views)
2014-12-03 16:27:13

CopyableCougar4 (102 views)
2014-11-29 21:32:03
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org 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‑gaming.org
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!