n5ro/aframe-physics-system

How can you change restitution when using aframe physics system with ammo.js

Jantu82 opened this issue · 1 comments

Is it possible to change the restitution (bounciness) somehow when using ammo.js with aframe physics system?

Restitution with ammo.js is zero by default which requires every object in collision to be given explicit value.

Example below uses a ball and floor:

AFRAME.registerComponent("do-something", {
        init: function () {
          var sceneEl = this.el;
          var floorEl = sceneEl.querySelector("#floor");
          var ballEl = sceneEl.querySelector("#ball");
          floorEl.body.setRestitution(0.9);
          ballEl.body.setRestitution(0.8);
        },
      });

<a-scene do-something>