如何从运动研究结果中获得特定时间的组件位置?

发布于 2025-01-26 03:53:39 字数 91 浏览 2 评论 0原文

我面临的问题是在运动研究结果中在特定时间获得组件的位置。 There is only GetCMPosition method in the

I am facing the problem to get position of a component at specific time from motion study result. There is only GetCMPosition method in the API, which is the center of mass, not the origin point of the component. So do I need to calculate it by myself? But I do think there is a better way to acquire it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我恋#小黄人 2025-02-02 03:53:39

几个小时后,我自己找到了一个解决方案...在这里发布伪代码,希望它能帮助某人。

public static ActionResult ExtractAnimation(this MotionStudy ms)
{
    if (!ms.Activate())
        return ActionResult.Error("activate motion study failed!");
    double duration = ms.GetDuration(); // in seconds

    if (duration <= 0) return ActionResult.Error("error message");

    for (double currentTime = 0; currentTime < duration; currentTime += AnimationStepSize)
    {
        ms.SetTime(currentTime);
        MethodUsingTransform(component.Transform2, currentTime);
    }

    ms.SetTime(duration);
    MethodUsingTransform(component.Transform2, duration);

    ms.Stop();
    return ActionResult.Success();
}

After several hours I found a solution myself... post pseudo code here and hope it could help someone.

public static ActionResult ExtractAnimation(this MotionStudy ms)
{
    if (!ms.Activate())
        return ActionResult.Error("activate motion study failed!");
    double duration = ms.GetDuration(); // in seconds

    if (duration <= 0) return ActionResult.Error("error message");

    for (double currentTime = 0; currentTime < duration; currentTime += AnimationStepSize)
    {
        ms.SetTime(currentTime);
        MethodUsingTransform(component.Transform2, currentTime);
    }

    ms.SetTime(duration);
    MethodUsingTransform(component.Transform2, duration);

    ms.Stop();
    return ActionResult.Success();
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文