Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/434.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript A帧相关性组件请求_Javascript_Entity_Augmented Reality_Aframe_Virtual Reality - Fatal编程技术网

Javascript A帧相关性组件请求

Javascript A帧相关性组件请求,javascript,entity,augmented-reality,aframe,virtual-reality,Javascript,Entity,Augmented Reality,Aframe,Virtual Reality,在A形框架上,实体相对于其父实体。如果移动父实体,子实体也会移动。太好了。但我认为,如果有一种方法可以指定一个实体相对于另一个实体,而不一定是它的父实体,那就太好了。甚至是相对于屏幕。下面是一段代码片段来说明我的意思: <a-entity id="entity1" position="0 0 0"> <a-entity id="entity2" relative = ""></a

在A形框架上,实体相对于其父实体。如果移动父实体,子实体也会移动。太好了。但我认为,如果有一种方法可以指定一个实体相对于另一个实体,而不一定是它的父实体,那就太好了。甚至是相对于屏幕。下面是一段代码片段来说明我的意思:

<a-entity id="entity1" position="0 0 0">
    <a-entity id="entity2" relative = ""></a-entity> <!-- "" or "#entity1" would make it relative to "entity1". This is the way it already works, so the relative component would have "" as the default value -->
    <a-entity id="entity3" relative = "#entity4"></a-entity> <!-- This makes "entity3" relative to "entity4", not "entity1" -->
    <a-entity id="entity5" relative = "#entity1 #entity4" relativeWeight = "0.5 0.5"></a-entity> <!-- This makes "entity5" half influenced by "entity1" and half by "entity4". But it could have other values like "0.8 0.2" or "1 0"(80% affected by entity1 and 20% by entity 4, then 100% affected by entity1 and 0% by entity4) -->
</a-entity>

<a-entity id="entity4" position="0 1 0">
</a-entity>

<a-entity id="entity6" relative="Screen"> <!-- I was thinking of some special values, like "Screen", "TopScreen", "BottomScreen", to make elements be relative to the center of the screen, top, bottom, etc.  -->
</a-entity>

<a-entity id="entity7" relative="#entity5"> <!-- This entity is relative to entity5, which in turn is relative to both entity1 and entity4. In practice, this makes entity7 be indirectly affected by entity1 and entity4 as well because of entity5. -->
</a-entity>

ZapWorks Studio也有这样一个功能:和

我认为这是一个非常有用的特性


例如,在增强现实体验中,有一个与跟踪相关的UI,但如果用户离开跟踪,UI就会出现在屏幕上。

约束的概念在物理库中很常见,最近在2D UI中,通过以下项目:

我还没有看到支持spring constraint for UI这个特定用例的A-Frame库,但去年我自己做了几个例子

显示带有A形框架物理组件的弹簧约束的基本示例:

下面是一个使用弹簧约束将剪贴板保持在VR用户oculus控制器附近的示例:

这是另一个实验。在桌面模式下,颜色选择器“停靠”到天空。当你进入虚拟现实模式时,它会与用户的手腕“对接”:它不像我希望的那样工作


您会注意到,弹簧约束不适用于A帧物理库中的弹药驱动程序。这个问题已经在这张票据中解决了,但还没有被推到主回购中:

可能从与增强现实体验中的跟踪相关的用例
UI开始,但是如果用户离开跟踪,用户界面进入屏幕
,显示您尝试过的代码将更有效地帮助人们提出解决方案。剥猫皮的方法总是不止一种。祝你好运。我要找的不是物理方面的东西,但我很感激这些信息。我将研究react spring,也许它可以作为一个指南,这样我就可以自己制作组件了。