meshes with physics

meshing
Fabien Benetou 2 years ago
parent 1b2fa784e3
commit ebd1fb19ea
  1. 29
      index.html

@ -20,6 +20,8 @@
<script src="https://naf.benetou.fr/easyrtc/easyrtc.js"></script> <script src="https://naf.benetou.fr/easyrtc/easyrtc.js"></script>
<script src='dependencies/networked-aframe.min.js'></script> <script src='dependencies/networked-aframe.min.js'></script>
<script src="https://cdn.jsdelivr.net/gh/c-frame/aframe-physics-system@v4.2.2/dist/aframe-physics-system.min.js"></script>
<!-- still experimenting, see webdav.html --> <!-- still experimenting, see webdav.html -->
<script src='dependencies/webdav.js'></script> <script src='dependencies/webdav.js'></script>
@ -2510,6 +2512,7 @@ function startMesher(){
elSecondary.addEventListener('pinchended', endedSecondary ); elSecondary.addEventListener('pinchended', endedSecondary );
function endedSecondary(){ function endedSecondary(){
targets.push(meshEl) targets.push(meshEl)
meshEl.setAttribute('dynamic-body', "")
//makeAnchorsVisibleOnTargets() // too large here //makeAnchorsVisibleOnTargets() // too large here
applyToClass("meshvertex", (e, val ) => e.setAttribute("visible", val), "false") applyToClass("meshvertex", (e, val ) => e.setAttribute("visible", val), "false")
el.removeEventListener('pinchended', end) el.removeEventListener('pinchended', end)
@ -2561,6 +2564,22 @@ function startMesher(){
} }
} }
AFRAME.registerComponent('dynamic-unless-picked', {
init: function(){
let el = this.el
el.setAttribute('dynamic-body', "")
this.el.addEventListener('picked', function (event) {
el.removeAttribute('dynamic-body')
el.setAttribute('static-body', "")
})
this.el.addEventListener('released', function (event) {
el.removeAttribute('static-body')
el.setAttribute('dynamic-body', "")
})
}
// should unregister on remove
})
// used for testing // used for testing
AFRAME.registerComponent('startfunctions', { AFRAME.registerComponent('startfunctions', {
init: function () { init: function () {
@ -2582,6 +2601,7 @@ AFRAME.registerComponent('startfunctions', {
<a-scene cursor="rayOrigin: mouse" raycaster="objects: [html]; interval:100;" adjust-height-in-vr <a-scene cursor="rayOrigin: mouse" raycaster="objects: [html]; interval:100;" adjust-height-in-vr
refresh-text-content-from-wiki-page="pagename:TestingPairCollaboration" refresh-text-content-from-wiki-page="pagename:TestingPairCollaboration"
startfunctions startfunctions
physics="debug:true"
toolbox disable-components-via-url enable-components-via-url NOcommands-from-external-json keyboard > toolbox disable-components-via-url enable-components-via-url NOcommands-from-external-json keyboard >
<!-- screenstack dynamic-view selectionboxonpinches glossary timeline issues fot <!-- screenstack dynamic-view selectionboxonpinches glossary timeline issues fot
networked-scene="serverURL: https://naf.benetou.fr/; adapter: easyrtc; audio: true;" networked-scene="serverURL: https://naf.benetou.fr/; adapter: easyrtc; audio: true;"
@ -2637,6 +2657,15 @@ AFRAME.registerComponent('startfunctions', {
--> -->
<a-console position="0 1.5 -2" font-size="34" height=1 skip-intro=true></a-console> <a-console position="0 1.5 -2" font-size="34" height=1 skip-intro=true></a-console>
<!-- Floor -->
<a-plane rotation="-90 0 0" scale="5 5 5" position="0 1 0" opacity=.5 static-body></a-plane>
<!-- Immovable box -->
<a-box static-body position="0 0.5 -5" width="3" height="1" depth="1"></a-box>
<!-- Dynamic box -->
<a-box dynamic-unless-picked position="0 1.4 -.3" target scale=".1 .1 .1"></a-box>
</a-scene> </a-scene>
</body> </body>
</html> </html>

Loading…
Cancel
Save