www.jpct.net
Bones - Skeletal and Pose Animations for jPCT/jPCT-AE => Bones => Topic started by: AGP on October 01, 2014, 08:49:03 pm
-
That would be beyond useful...
-
I did the following:
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:
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);
}
-
and the question is?
i cant see the relation between jPCT camera and Bones
-
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.
-
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
-
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.
-
i cant see the relation between the model being single part and adding an object as a child of Joint ???
-
I want the gun to move up and down as the hand, not the object as a whole, moves up and down.
-
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...
-
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.
-
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?).
-
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.
-
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?
-
yes that is what SkeletonDebugger does
-
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")?
-
Please try the following jar:
http://aptalkarga.com/bones/bones_tmp.jar
if joint has a name, corresponding joint object in SkeletonDebugger will have that name. o/w it will be named as joint_[index]. bone objects are named as [parent joint's name] -> [joint's name]
-
I appreciate it, pal. Thanks. But do I have to re-export my models, now (see below)?
File? Yes. Success? No: Version mismatch. Current version: 4, stream version: 3
Exception in thread "main" java.lang.NullPointerException
at Hero.<init>(Hero.java:27)
at RPG3D.loadModels(RPG3D.java:673)
at RPG3D.<init>(RPG3D.java:115)
at RPG3D.main(RPG3D.java:1013)
-
your exception is not Bones related as stack trace has no Bones class ;)
but right, I had increased the internal stream version to 4 as mentioned in first line. you dont need to re-export your models but convert them from Ogre format to Bones' binary format again.
-
I will, then, but line 27 is
SkinClipSequence clipSequence = model.getSkinClipSequence();
-
possibly you couldnt loaded the model because Bones had thrown an IOException complaining about version mismatch, you caught the exception then tried to access to model and had an NPE
-
Makes sense. Thanks again.