I dev a little game, and I went at the beginning of the game, the gravity at -40, but after if the player wants to change it, he can.
I have this form:
<form>
<input type="text" id="userInput" />
<input type="submit" onclick="otherG();" />
</form>
My gravity is:
function initScene() {
blablabla
scene.setGravity(new THREE.Vector3(0, -40, 0));
blablabla
}
How can I change the -40 by the input of the user, and allow the scene (no need do f5) ?
The form appear when the user wants to change gravity via a keypress.
PS: I'm using three.js and physijs.
return falseat the end of the function to prevent this.scene.setGravity(new THREE.Vector3(0, someNewValue, 0));?scenea global var?