- For a skeleton loader i’m working on, I would like to know where to store Skeleton in SkeletonControl or AnimControl ?
- From where to search the skeleton of a spatial ?
- What is deprecated ?
Thanks for any info
Thanks for any info
like the following ?
public void link(Spatial v, Skeleton sk) {
v.removeControl(AnimControl.class);
v.removeControl(SkeletonControl.class);
v.addControl(new SkeletonControl(sk));
v.addControl(new AnimControl(sk));
}
is it better ?
public void link(Spatial v, Skeleton sk) {
v.removeControl(SkeletonControl.class);
v.addControl(new SkeletonControl(sk));
//update AnimControl if related to skeleton
AnimControl ac = v.getControl(AnimControl.class);
if (ac != null && ac.getSkeleton() != null) {
v.removeControl(ac);
v.addControl(new AnimControl(sk));
}
}
That’s correct, except for one thing: You have to make sure the SkeletonControl is always after the AnimControl in the list.
This is because AnimControl animates the skeleton first, then SkeletonControl will move the model’s vertices according to the animated skeleton.
public void link(Spatial v, Skeleton sk) {
v.removeControl(SkeletonControl.class);
//update AnimControl if related to skeleton
AnimControl ac = v.getControl(AnimControl.class);
if (ac != null && ac.getSkeleton() != null) {
v.removeControl(ac);
v.addControl(new AnimControl(sk));
}
// SkeletonControl should be after AnimControl in the list of Controls
v.addControl(new SkeletonControl(sk));
}