- Home /
Making an object frictionless at the push of a button
I have these two functions for removing and reinstating friction for a physics object, here they are
function removeFriction () { var frictionlessMaterial = new PhysicMaterial(); frictionlessMaterial.dynamicFriction = 0; collider.material = frictionlessMaterial; }
function reinstateFriction () { var standardMaterial = new PhysicMaterial(); standardMaterial.dynamicFriction = 1; collider.material = standardMaterial; }
the problem is, nither of them work. When I told it to print out the dynamic friction it's 0.4, so clearly niether of them have worked even once. I've tried modifying a single material as well, but that doesn't seem to work either. What am I doing wrong?
Answer by Popoid Android · Oct 22, 2010 at 02:22 PM
wait, no, typically I've solved it as soon as I asked the question. here's the new functions
function removeFriction () { collider.material.dynamicFriction = 0; }
function reinstateFriction () { collider.material.dynamicFriction = 1; }