@LuoHui
The issue you’re encountering is likely due to binding the animation to the Rotation property directly, rather than using the EulerAngles property, which is the correct and documented way to animate rotations in Aspose.3D for FBX files.
- Use
EulerAngles instead of Rotation:
The Rotation property may not represent Euler angles directly and could be interpreted differently depending on the internal representation (e.g., quaternions or axis-angle). When animating rotational transformations with expected Euler angle behavior, you should bind to the EulerAngles property of the transform . Your current code uses:
Property Rotation = cube1.Transform.FindProperty("Rotation");
This is not the recommended approach for Euler angle animation.
- Correct binding via
EulerAngles:
As shown in official examples, rotation animations should be bound to Transform.EulerAngles, and keyframe sequences should target specific axes like "X", "Y", or "Z" under that property . For example:
BindPoint bindPoint = new BindPoint(scene, cube1.Transform, "EulerAngles");
bindPoint.BindKeyframeSequence("Y", new KeyframeSequence()
{
{ 0, 0.0f },
{ 3, 30.0f },
{ 6, 0.0f }
});
This ensures that the values you input (like 30.0f) are interpreted as degrees around the Y-axis in Euler angle space.
-
Why separate X/Z works but values differ:
You mentioned that setting X or Z axes separately works, but the angles don’t match expectations. This further suggests that the Rotation property is not mapping 1:1 to Euler angles — it may be using a different rotation representation (e.g., quaternion components or transformed values), leading to non-intuitive input-output relationships .
-
Recommended fix:
Update your code to bind to EulerAngles instead:
private static void testfbx()
{
Scene scene = new Scene();
Node cube1 = scene.RootNode.CreateChildNode("cube1", new Box());
// Bind to EulerAngles, not Rotation
BindPoint bindPoint = new BindPoint(scene, cube1.Transform, "EulerAngles");
bindPoint.BindKeyframeSequence("Y", new KeyframeSequence()
{
{ 0, 0.0f, Interpolation.Constant },
{ 3, 30.0f, Interpolation.Constant },
{ 6, 0.0f, Interpolation.Constant }
});
scene.Save(@"C:\Users\Administrator\Desktop\1\test2.fbx", FileFormat.FBX7700ASCII);
}
This approach aligns with documented usage patterns and should produce the expected Euler angle rotation animation . The problem is therefore most likely due to incorrect property usage, not a bug in Aspose.3D.