Author Topic: Joint.addChild(Object3D)  (Read 33340 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Joint.addChild(Object3D)
« on: October 01, 2014, 08:49:03 pm »
That would be beyond useful...

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Joint.addChild(Object3D)
« Reply #1 on: October 01, 2014, 09:20:11 pm »
I did the following:

Code: [Select]
     gun.setRotationMatrix(rightHand.getBindPose());
     moveTo(gun, getJointPosition(rightHand));

I appears to work ONLY if I don't call the following (necessary) method that updates the camera's position and rotation:

Code: [Select]
     private void follow(AnimatedGroup group) {
Animated3D toFollow = group.get(0);
Matrix matrix = toFollow.getWorldTransformation().invert3x3();
theCamera.setBack(matrix);
SimpleVector center = toFollow.getTransformedCenter();
theCamera.setPosition(center);
theCamera.rotateCameraY((float)Math.PI +cameraDisplacementY);
skeletonPose.updateTransforms();
theCamera.moveCamera(Camera.CAMERA_MOVEOUT, cameraToObjectDistance);
     }
« Last Edit: October 01, 2014, 10:56:05 pm by AGP »

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Joint.addChild(Object3D)
« Reply #2 on: October 02, 2014, 08:52:01 am »
and the question is?

i cant see the relation between jPCT camera and Bones

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Joint.addChild(Object3D)
« Reply #3 on: October 02, 2014, 08:20:57 pm »
The question was stated clearly in two parts: a request for Joint.addChild(Object3D) and a solution for the equivalent. I don't see the relationship, either. In further tests, whenever the character rotates AND follow() gets called, the gun's rotation breaks (it seems to rotate counter-camera). But if either just the camera or just the character rotates, that above code works.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Joint.addChild(Object3D)
« Reply #4 on: October 03, 2014, 10:36:16 am »
Joint is not a 3d object but a piece of data. adding a child to it makes no sense IMHO. you can achieve a similar effect by adding your object as child to relevant Object3D in SkeletonDebugger.

for the Camera, I dont know. that just doesnt make sense. there must be some other reason

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Joint.addChild(Object3D)
« Reply #5 on: October 03, 2014, 07:59:00 pm »
The problem is that in this case the entire human model has a single part. Obviously, the hand moves differently from the rest of the body. Which is why I think that you should be able to add an Object3D as a child of a Joint.

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Joint.addChild(Object3D)
« Reply #6 on: October 04, 2014, 02:14:37 pm »
i cant see the relation between the model being single part and adding an object as a child of Joint  ???

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Joint.addChild(Object3D)
« Reply #7 on: October 05, 2014, 01:49:06 am »
I want the gun to move up and down as the hand, not the object as a whole, moves up and down.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Joint.addChild(Object3D)
« Reply #8 on: October 05, 2014, 01:51:10 am »
Look, in this particular case, I've solved it by adjusting the gun's position to the Joint's ever iteration and by rotating the gun whenever I rotate the character. But I maintain that adding an Object3D as child of a Joint would be very useful. Surely you can see how useful it can be for any item the character may hold...

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Joint.addChild(Object3D)
« Reply #9 on: October 05, 2014, 03:40:27 pm »
I can see it may be useful but as i said you can achieve a similar effect by adding your object as child to relevant Object3D in SkeletonDebugger.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Joint.addChild(Object3D)
« Reply #10 on: October 05, 2014, 07:24:37 pm »
I'm not sure how that would be different than just adding it to the hero straight up (in which case the gun would probably move the average of the entire idle movement or something similar, right?).

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Joint.addChild(Object3D)
« Reply #11 on: October 06, 2014, 12:54:58 pm »
i cant understand your line of thought. you want the gun follow the joint right? the objects corresponding to joints in SkeletonDebugger already do that. if you add your gun as child to corresponding object, it will also follow the joint.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Joint.addChild(Object3D)
« Reply #12 on: October 06, 2014, 07:23:32 pm »
The only way your point makes sense is if Bones creates internal objects, that are not the actual hero model, corresponding to the joints. Is that what it does?

Offline raft

  • Moderator
  • quad
  • *****
  • Posts: 1993
    • View Profile
    • http://www.aptalkarga.com
Re: Joint.addChild(Object3D)
« Reply #13 on: October 07, 2014, 01:17:03 pm »
yes that is what SkeletonDebugger does

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Joint.addChild(Object3D)
« Reply #14 on: December 15, 2014, 06:49:26 pm »
The kinds of names I'm getting from SkeletonDebugger are "object4359." Is there a way in which for me to identify which object was created for which joint (the joints themselves have Biped names like "Bip01 R Hand")?