我有3个立方体连接到电枢。动画制作时,是否可以获得特定立方体的转换?
2个顶部立方体上下波动。我想要做的是在动画时将红色立方体放在左侧白色立方体上,使其看起来像红色立方体是动画的。
private void doneLoading() {
Model model = assets.get("data/cubes.g3db", Model.class);
Model model2 = assets.get("data/colored.g3db", Model.class);
cubes = new ModelInstance(model);
con = new AnimationController(cubes);
con.setAnimation(cubes.animations.get(0).id, -1);
red = new ModelInstance(model2, "Red");
instances.add(cubes);
instances.add(red);
}
//in render function
if(!loading){
//Tried, but it's not changing during animation
//Node left = cubes.getNode("Cubel");
//Matrix4 mat = left.globalTransform;
//System.out.println(mat.toString());
//This worked but the red cube is on the bone's position, not on the white cube's.
Matrix4 mat = con.current.animation.nodeAnimations.get(0).node.globalTransform;
red.transform.set(mat);
con.update(delta);
loading = false;
}
黄色 - 代表骨架或骨骼
绿色 - 动画期间的动作