Author Topic: Negative Y Isn't Going Up  (Read 2501 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Negative Y Isn't Going Up
« 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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Negative Y Isn't Going Up
« Reply #1 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?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Negative Y Isn't Going Up
« Reply #2 on: January 26, 2014, 10:09:55 pm »
Its parent has, why?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Negative Y Isn't Going Up
« Reply #3 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);

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Negative Y Isn't Going Up
« Reply #4 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?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Negative Y Isn't Going Up
« Reply #5 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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Negative Y Isn't Going Up
« Reply #6 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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Negative Y Isn't Going Up
« Reply #7 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).

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Negative Y Isn't Going Up
« Reply #8 on: January 26, 2014, 11:33:36 pm »
I'll look into something like that...