Author Topic: Weird getRoot().translate Behavior  (Read 15879 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Weird getRoot().translate Behavior
« on: June 13, 2013, 10:47:12 am »
Input:
Code: [Select]
else if (keyCode == KeyEvent.VK_M) {//keyReleased CODE
     ironMan.prepareToFly = ironMan.fly = false;
System.out.println("Height before drop: "+ironMan.height);
     ironMan.model.getRoot().translate(0, -ironMan.height, 0);
     ironMan.height = 0.000f;
}

Logic:
Code: [Select]
else if (prepareToFly) {
     model.animateSkin((frame+=.12f), 5);
     model.getRoot().translate(0, (height+=((float)(-8f*deltaTime))), 0);
     if (frame >= 1.00f) {
System.out.println("Total height: "+height);
prepareToFly = false;
fly = true;
     }
}
else if (fly)
     model.animateSkin((frame+=.12f), 2);

Result: ironMan drops far less than he flew up (stays above ground). But the println show identical values for ironMan.height. What gives?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Weird getRoot().translate Behavior
« Reply #1 on: June 13, 2013, 03:19:30 pm »
I dont know ???

but I guess that is neither related to Bones nor jPCT. it is related to your game logic. there is nothing special with root of AnimatedGroup, it's just an ordinary jPCT object

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Weird getRoot().translate Behavior
« Reply #2 on: June 13, 2013, 05:12:21 pm »
How, though, when both println statements print the same value? Something's weird here.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Weird getRoot().translate Behavior
« Reply #3 on: June 13, 2013, 05:24:38 pm »
Never mind. Sleeping pill talking. :- ) The problem could be found in the posted code (every iteration was moving the model by its current total and it got moved down a single time by that amount. Thanks for your time.