www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: .jayderyu on January 05, 2009, 08:37:22 am

Title: 2D Layer?
Post by: .jayderyu on January 05, 2009, 08:37:22 am
Ok things are going nicely. I guess :P

I'm having some other problems. So If you could bear with me.

1. What angle system does JPCT use? Right, Left? Is towards the user +Z? is in +Z +X to the right....

and more importantly

2. I am using JBox2d. I can get the physics to work and "bind" the Object3d to the Physics body. There is however a problem. In relation to 1. I don't know if i'm seeing the physics matching the 3d. So here is what i'm looking for

A layer ontop of the 3d where I can line draw the physics objects where it is transparent. That way I can maybe see somekind of merger to validate what's happening.
Title: Re: 2D Layer?
Post by: EgonOlsen on January 05, 2009, 10:51:13 am
jPCT's x-axis goes to the right, z+ goes into the screen and y+ goes down(!). I think a 2d layer on top of the 3d will be difficult. Are you using software-, hardware- or awtgl-renderer?
Title: Re: 2D Layer?
Post by: .jayderyu on January 06, 2009, 08:07:20 am
Thanks for the coord listing. That will help line up with the physics engine.
So assuming we are simulating a 2d view.
X+ goes to the left.
Y+ goes down
Z+ is further into the background.
Ok got it thanks.

I'm using hardware in an applet

I have another question.
When I create an object with a 0.01 height(2d view so little depth is needed) I believe that the box, cylinder are created along the X axis. So with the camera panned out I can see very little.
What Z rotation would I need to set it perfeclty along the Z axis.
Title: Re: 2D Layer?
Post by: paulscode on January 06, 2009, 02:18:20 pm
X+ goes to the left.
Y+ goes down
Z+ is further into the background.
+X points to the right whenever +Y is down and +Z is foward.
Title: Re: 2D Layer?
Post by: EgonOlsen on January 06, 2009, 04:33:31 pm
When I create an object with a 0.01 height(2d view so little depth is needed) I believe that the box, cylinder are created along the X axis. So with the camera panned out I can see very little.
What Z rotation would I need to set it perfeclty along the Z axis.
90°, i.e. +-Math.PI/2
Title: Re: 2D Layer?
Post by: .jayderyu on January 06, 2009, 10:28:59 pm
awesome, thank you both very much :)

Ok last question. I'm not sure how it works. I'm asking here first because this forum is more about rotation than physics.

Is there a way to match a 2d angle to an Object3d rotation. I find that with rotation I activly rotate it by the applied value. So I can't just object3d.rotateZ(box2dBody.angle). I end up with a box spinning insanely.
I've tried applying only the difference between last and current frame. This works much better. You can't really see a problem when it's moving, but when it stops bouncing and is still. The graphical Obejct3D box is at angle with a corner sitting in the ground.

So basiclly I need to figure how to mesh the 2d.angle with a 3d.rotation or pivot.

I think this will pretty much cover it. I hope.
Title: Re: 2D Layer?
Post by: paulscode on January 08, 2009, 05:26:11 am
I was a little unclear about your question.  Were you asking how to rotate something using a global rotation angle rather than using an angle relative to its current orientation?