如何获得away3D中的顶级孩子?

发布于 2024-11-07 23:01:23 字数 817 浏览 0 评论 0原文

我有一个关于away3D 的小问题。我有一些尺寸完全相同的立方体,它们位于同一位置。当我单击立方体堆栈时,我想注册对我最后添加的立方体的单击。与此相反,单击是在我首先添加的多维数据集上注册的。

我找到了一种改变容器中立方体位置的方法,并尝试将元素放在childrenArray的末尾(代码如下)和开头,但似乎没有任何效果。我真的被困在这里了,所以如果有人知道如何在单击堆栈时获取顶级元素,我会很高兴听到。

//We get the targetCube's childIndex.
for(var i:uint = 0; i < _3DContent.children.length; i++)
{
    if(_targetCube == _3DContent.children[i])
        break;
}

//Now we rearrange the array if the targetCube is different from
//the last cube in our list of children.
if(i != _3DContent.children.length-1)
{
    //We reposition the children.
    for(var j:uint = i; j < _3DContent.children.length-1; j++)
        _3DContent.children[j] = _3DContent.children[j+1];

    //Lastly, we push the child.
    _3DContent.children[_3DContent.children.length-1] = _targetCube;
}

i have a small question concerning away3D. I have some cubes with the exact same dimensions that are positioned in the same place. When i click on the stack of cubes, i want to register a click on the cube i added last. Instead of doing this, the click is registered on the cube i added first.

I have found a way to alter the cubes position in the container and have tried putting the element at the end (code below) and start of the childrenArray, but nothing seems to work. I am kinda really stuck here, so if anyone knows how to get the top level element when clicking on the stack, i'd be happy to hear.

//We get the targetCube's childIndex.
for(var i:uint = 0; i < _3DContent.children.length; i++)
{
    if(_targetCube == _3DContent.children[i])
        break;
}

//Now we rearrange the array if the targetCube is different from
//the last cube in our list of children.
if(i != _3DContent.children.length-1)
{
    //We reposition the children.
    for(var j:uint = i; j < _3DContent.children.length-1; j++)
        _3DContent.children[j] = _3DContent.children[j+1];

    //Lastly, we push the child.
    _3DContent.children[_3DContent.children.length-1] = _targetCube;
}

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

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

发布评论

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

评论(1

写给空气的情书 2024-11-14 23:01:23

我通过使用不同的渲染器解决了这个问题。创建视图时,您应该将其作为参数传递,如下所示。

_view = new View3D({renderer: Renderer.CORRECT_Z_ORDER});

I solved the problem by using a different renderer. When creating your view, you should pass this as a parameter, as shown below.

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