【问题标题】:LibGDX: Tracking nodes while moving/animateLibGDX:在移动/动画时跟踪节点
【发布时间】:2018-10-23 04:25:44
【问题描述】:

有谁知道如何在移动/动画时跟踪 ModelInstance 中节点的位置?

Vector3 moving = new Vector3()
entity.modelInstance.getNode("RightHand").localTransform.getTranslation(moving);

modelInstance 移动位置时似乎没有引用该值。

使用此代码时会出现相同的结果

mov = beMainChar.modelInstance.getNode("RightHand").translation

提前谢谢你

【问题讨论】:

  • 我的意思是当 entity.modelInstance 移动到新位置时,Vector3 移动值仍然相同

标签: java libgdx game-engine


【解决方案1】:

RightHandlocalTransform 不会改变,因为 ModelInstance 被转换为另一个全局位置,因为您需要检查 NodeglobalTransform

Vector3 moving = new Vector3();
entity.modelInstance.calculateWorldTransform();
entity.ModelInstance.getNode("RightHand").globalTransform.getTranslation(moving);

【讨论】:

  • 谢谢,是的,我试过了,但是移动值没有改变,我发现关于节点translation的文档没有被动画修改,那么我怎样才能跟踪新节点的位置呢?
  • calculateWorldTransform() 不是这样的方法,也许你的意思是 calculateTransform()..
猜你喜欢
  • 2011-05-15
  • 1970-01-01
  • 1970-01-01
  • 2022-01-05
  • 1970-01-01
  • 1970-01-01
  • 2021-02-06
  • 1970-01-01
  • 2014-07-18
相关资源
最近更新 更多