Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Can't change Ammo driver friction coefficient #198

Open
AnaCoda opened this issue Dec 15, 2021 · 2 comments
Open

Can't change Ammo driver friction coefficient #198

AnaCoda opened this issue Dec 15, 2021 · 2 comments

Comments

@AnaCoda
Copy link

AnaCoda commented Dec 15, 2021

How can I change the friction coefficient when using the Ammo driver?

I tried as follows: <a-scene physics=" driver: ammo; debug:true; debugDrawMode: 0; friction: 0.001;">,
but nothing seems to change no matter what value I put for friction.

@martaquintana
Copy link

Hello,
I had the same problem and for me works when i set restitiution after load all html file via javascript. You can try with attribute restitution


var sceneEl = document.querySelector('a-scene');
sceneEl.querySelector("#a-plane").body.setRestitution(0.8); 

@aaishikdutta
Copy link

Hello @martaquintana, setting restitution using setRestitution adds bounciness and not friction. What you're looking for @AnaCoda can be done using:

var sceneEl = document.querySelector('a-scene');
sceneEl.querySelector("#a-plane").body.setFriction(0.8); 

Also, a pointer to keep in mind that if you're importing a gltf model then you should probably try to listen for the body-loaded event then do the above.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants