0

我最初在 Vector3 中设置了我的 TransformableNode 大小。然后我缩放了我的 TransformableNode。我现在想要 Vector3 中以米尼特为单位的缩放 TransformableNode 大小。请帮助我。我尝试了这些但没有得到任何解决方案:

Vector3 vec = transformableNode.getLocalPosition();
Vector3 vector = transformableNode.getWorldPosition();
Vector3 vector31 = transformableNode.getWorldScale();
Vector3 vector32 = transformableNode.getLocalScale();
Log.e("Vector Local Position: ", String.valueOf(vec.x + " " + vec.y + " " + vec.z));
Log.e("Vector World Position: ", String.valueOf(vector.x + " " + vector.y + " " + vector.z));
Log.e("Vector World Scale: ", String.valueOf(vector31.x + " " + vector31.y + " " + vector31.z));
Log.e("Vector Local Scale: ", String.valueOf(vector32.x + " " + vector32.y + " " + vector32.z));
4

1 回答 1

3

要以米为单位获取可渲染对象的大小,您可以执行以下操作:

Box box = (Box) transformableNode.getRenderable().getCollisionShape();
Vector3 renderableSize = box.getSize();

获得可渲染对象的大小后,您可以通过将可渲染对象的大小乘以比例来获得 TransformableNode 的最终大小:

Vector3 transformableNodeScale = transformableNode.getWorldScale();
  Vector3 finalSize =
      new Vector3(
          renderableSize.x * transformableNodeScale.x,
          renderableSize.y * transformableNodeScale.y,
          renderableSize.z * transformableNodeScale.z);
于 2018-10-15T18:37:08.980 回答