use-cannon icon indicating copy to clipboard operation
use-cannon copied to clipboard

presets

Open drcmda opened this issue 4 years ago • 5 comments

      <Physics
        defaultContactMaterial={{
          friction: 0.9,
          restitution: 0.7,
          contactEquationStiffness: 1e7,
          contactEquationRelaxation: 1,
          frictionEquationStiffness: 1e7,
          frictionEquationRelaxation: 2,
        }}

would it be a good idea to introduce presets for stuff like this? bouncy, crude, slippery, whatever name would make sense. for react-spring we had 4 or 5, so that users dont need to remember what damping and tension are, but here it seems even more critical, because it's probably harder to understand what these values actually mean.

drcmda avatar May 25 '20 19:05 drcmda

This is a great idea. Could we also make a demo that loops/resets a collision between two objects, and use react-three-gui to update ContactMaterial props? That way users could play with settings and see the results in real time

codynova avatar May 25 '20 23:05 codynova

sounds great!

drcmda avatar May 26 '20 09:05 drcmda

@codynova do you know what names would be good and what values we could use?

drcmda avatar May 26 '20 10:05 drcmda

Screenshot_20200526-122820

When you talk about react Spring presets, you mean those ?

Franckapik avatar May 26 '20 10:05 Franckapik

yes. would be good if use-cannon had something similar. or maybe even material qualities that people can mix.

import { contact } from 'use-cannon'

<Physics
  defaultContactMaterial={{
    ...contact.friction.medium,
    ...contact.restitution.high
  }} />

drcmda avatar May 26 '20 12:05 drcmda