n5ro / aframe-physics-system

Physics system for A-Frame VR, built on CANNON.js.
https://n5ro.github.io/aframe-physics-system/
MIT License
505 stars 136 forks source link

I'm trying to commute debug mode dynamically (I have a use case for this). After modiying I can check physics="debug:false" in DOM but it has no effect (the debug is still active). #166

Open palvim opened 4 years ago

n5ro commented 4 years ago

I recommend sending a minimum code example of the problem, like using glitch or codepen, then other people can run the demo and try to figure out what the source of the problem is.

palvim commented 4 years ago

Ok, sure! Thank you... here's a demo trying to modify debug mode dynamically after 5sec: https://codepen.io/pAlvim/pen/abNeWBd (codepen)

`<!DOCTYPE html>

Aframe Physics `
n5ro commented 3 years ago

""//cdn.rawgit.com/donmccurdy/aframe-extras/v3.12.4/dist/aframe-extras.min.js"> <script src="https://unpkg.com/aframe-physics-extras/dist/aframe-physics-extras.min.js"

Is that a typo? Shouldn't that second line say Aframe Physics System? hmm...

n5ro commented 3 years ago

Maybe try updating to the latest Aframe 1.0.4 if you can.

n5ro commented 3 years ago

What is the event that is supposed to trigger the debug attribute to toggle from true to false? What event are you listening for?

n5ro commented 3 years ago

I don't understand what you are doing with the set timeout in the body, simulate issue?

This is an example of what a set time out looks like. "var load = setTimeout(function() { document.getElementById("redirect").src="js/load.js";

}, 5000);"

Another example:

var myVar;

function myFunction() { myVar = setTimeout(alertFunc, 3000); }

function alertFunc() { alert("Hello!"); }

https://www.w3schools.com/jsref/met_win_settimeout.asp

I hope that is helpful.

n5ro commented 3 years ago

If the setTimeout is meant to trigger your debug mode to change from true to false, then you need to emit an event in the setTimeout(function) and it could be where you might set the attribute of the debug to false, inside the setTimeout I mean.

palvim commented 3 years ago

Thank you very much! I had other reason that ended up landing me to divide my page in two. So I keep one of them with debug=true. But I'll check your suggestions when possible and post here. Thanks again.