www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: AGP on January 26, 2014, 09:57:36 pm

Title: Negative Y Isn't Going Up
Post by: AGP on January 26, 2014, 09:57:36 pm
I have a scene that's completely aligned with its SkyBox. Yet when I translate an object with mainGate.translate(0, -deltaTime, 0), it moves on what I think is the x/z plane. What gives?
Title: Re: Negative Y Isn't Going Up
Post by: EgonOlsen on January 26, 2014, 10:08:51 pm
Maybe your camera doesn't look down the z-axis but down the y-axis? Has the object been rotated?
Title: Re: Negative Y Isn't Going Up
Post by: AGP on January 26, 2014, 10:09:55 pm
Its parent has, why?
Title: Re: Negative Y Isn't Going Up
Post by: EgonOlsen on January 26, 2014, 10:23:14 pm
I see...due to the way in which the transformations of childs and parents are concatenated, this will actually rotate the child's object space coordinate system. You might want to try this instead:

Code: [Select]
SimpleVector ya=parent.getYAxis();
ya.scalarMul(deltaTime);
child.translate(ya);
Title: Re: Negative Y Isn't Going Up
Post by: AGP on January 26, 2014, 10:28:59 pm
I see, thank you. Does the fact that it worked confirm that the game is in fact in the x/z plane?
Title: Re: Negative Y Isn't Going Up
Post by: AGP on January 26, 2014, 10:32:00 pm
How do you feel about adding a removeParentButCommitTransformations() (or whatever you want to call it) method to Object3D?
Title: Re: Negative Y Isn't Going Up
Post by: EgonOlsen on January 26, 2014, 10:47:51 pm
I see, thank you. Does the fact that it worked confirm that the game is in fact in the x/z plane?
Yes, all is fine then.
Title: Re: Negative Y Isn't Going Up
Post by: AGP on January 26, 2014, 11:00:50 pm
Cool. What about the method? Is that a possibility? You can clearly see how useful it would be (whenever you have multiple parts of a single set that need to be rotated and translated into place).
Title: Re: Negative Y Isn't Going Up
Post by: EgonOlsen on January 26, 2014, 11:33:36 pm
I'll look into something like that...