actionscript-3 - 在 AS3 中获取宽度、高度、沿 3D 空间对象的位置

标签 actionscript-3 3d

我在理解对象的 x 和 y 位置及其 3D 旋转和 z 位置之间的关系时遇到一些问题。

在 3D 空间中操作对象时,如何确定对象的高度和宽度?我认为它与 getRelativeMatrix3D() 有关,但不知道如何。

如果我想确定沿一个对象的全局 x 和 y(不是对象的“主”x 或 y,而是沿对象“表面”的任何点),我该如何做这样做吗?

感谢您的帮助。

最佳答案

我认为 getBounds 已经解决了宽度和高度问题。

  var obj:Sprite = new Sprite();
  obj.graphics.lineStyle(0,0,1);
  obj.graphics.beginFill(0xff9933,1);
  obj.graphics.drawRect(0,0,50,50);
  obj.graphics.endFill();

  obj.z = 0;
  addChild(obj);
  trace(obj.getBounds(obj));
  trace(obj.getBounds(this));

  obj.rotationX = 30;
  obj.rotationY = 50;
  trace(obj.getBounds(obj));
  trace(obj.getBounds(this));

  //output:
    (x=0, y=0, w=50, h=50)
    (x=0, y=0, w=50, h=50)
    (x=0, y=0, w=50, h=50)
    (x=0, y=-16, w=42, h=64)

不过,我不确定您对问题的第二部分要问什么。假设您仍然想要答案...

If I want to determine the global x and y along an object (that is not the object's 'main' x or y, but at any point along the object's 'surface') how do I do that?

关于actionscript-3 - 在 AS3 中获取宽度、高度、沿 3D 空间对象的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15938640/

相关文章:

flash - 从fla中提取声音

apache-flex - 是否有组件不再显示在屏幕上时触发的事件?

HTML/CSS : flip3d how to do a 360 degrees with 4 pictures

algorithm - 在访问所有单元格的 3D 体素空间中的两点之间走一条线

c++ - 使用 glFrustum 改变坐标

apache-flex - 调用内联函数并传入当前项目作为参数 - Flex 3

actionscript-3 - 快速确定数据在数组中的位置

actionscript-3 - Adobe AIR 应用程序音频

3d - three.js 加载 obj/mtl 呈现黑色

javascript - 如何在没有 css3 和 webGL 的情况下将 3d 透视添加到 html5 Canvas