Author Topic: getRoot().getTransformedCenter() is Weird  (Read 2143 times)

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
getRoot().getTransformedCenter() is Weird
« on: July 15, 2014, 10:27:10 pm »
As you translate a model by its root, its transformed center values don't look right even as the model moves the right way. I believe that that is a bug. Is it?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: getRoot().getTransformedCenter() is Weird
« Reply #1 on: July 16, 2014, 08:35:29 am »
i dont think so. getTransformedCenter() is a method of core jPCT. what do you mean exactly by weird?

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: getRoot().getTransformedCenter() is Weird
« Reply #2 on: July 16, 2014, 08:31:02 pm »
The distance between the results grows even as the models approach each other. See this thread: http://www.jpct.net/forum2/index.php/topic,4017.0.html

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: getRoot().getTransformedCenter() is Weird
« Reply #3 on: July 17, 2014, 09:18:28 am »
can you send me a test case please?

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: getRoot().getTransformedCenter() is Weird
« Reply #4 on: July 18, 2014, 09:55:15 am »
I will make you one soon, thank you.

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: getRoot().getTransformedCenter() is Weird
« Reply #5 on: July 24, 2014, 11:17:25 pm »
Sorry I took this long. I made this one less neat than I wished, but, alas, here it is: https://dl.dropboxusercontent.com/u/93826015/BonesCenterTester.rar

Check out the distance printout as the models approach each other.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: getRoot().getTransformedCenter() is Weird
« Reply #6 on: July 25, 2014, 08:20:42 am »
i'll look into it when i return to city. a few days later

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: getRoot().getTransformedCenter() is Weird
« Reply #7 on: July 31, 2014, 10:46:00 am »
i've run your test case. what exactly should I look into? what i see is two ironman's are looking each other, idle animation is running and nothing else happens ???

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: getRoot().getTransformedCenter() is Weird
« Reply #8 on: July 31, 2014, 10:05:37 pm »
Is one not approaching the other? If not, move one by pressing the UP key.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: getRoot().getTransformedCenter() is Weird
« Reply #9 on: August 01, 2014, 10:00:14 am »
strange ??? i have no idea what causes that. meanwhile you can use AnimatedGroup.getRoot().getTranslation() instead of getRoot().getTransformedCenter(). that seem to work correct. since root is a dummy object with no triangles its transformed center and its translation are the same.

btw, sometimes keys dont work that's why I couldnt find move key in the first time. this is a windows 8.1 machine

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: getRoot().getTransformedCenter() is Weird
« Reply #10 on: August 01, 2014, 10:15:35 am »
That's a Java focus thing (either I added KeyMapper to the frame or to the Canvas and it's supposed to be the other one). Very likely it's a Java events bug, but as long as you don't mess with the frame (just start the program and don't ALT-TAB or anything) it should always work.

For my program, I have solved the position issue by adding a child object and getting its center, but it would be nice to figure out what this issue is (and potentially solve it).

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: getRoot().getTransformedCenter() is Weird
« Reply #11 on: August 01, 2014, 10:19:28 am »
but it would be nice to figure out what this issue is (and potentially solve it).
agreed. i'm very curious what kind of a strange bug causes this ;)

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: getRoot().getTransformedCenter() is Weird
« Reply #12 on: August 05, 2014, 03:45:14 pm »
i guess there is no problem here. you set center's of root objects that's why getTranslation and getTransformedCenter return different values. that's also the reason of numeric distance is increasing when objects visually come closer.

Offline AGP

  • quad
  • ******
  • Posts: 1518
    • View Profile
Re: getRoot().getTransformedCenter() is Weird
« Reply #13 on: August 07, 2014, 11:10:49 pm »
I don't get it. How would the distance grow either way? And if I ever called setCenter on root, it was to solve this very issue. Try removing it and see.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: getRoot().getTransformedCenter() is Weird
« Reply #14 on: August 08, 2014, 09:34:24 am »
and there is also another problem. see the screenshots. in the first the model is bind pose, in the second its animated. as you see the skeleton and the model moves somewhere else when animating. you can load your model into LoadBonesFormatSample and see yourself. so root's transformed center or translation does not reflect the actual place of the model.

this is either caused by wrong skinning or the exporter, not sure.