You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constExample=()=>{const[_,api]=useCircle(...)useEffect(()=>{api.linearDamping.set(someValue)// this works!},[])// ...}
But providing linearDamping in the props of a body hook doesn't work. From a quick look, it appears that's because propsToBody doesn't have any handling for the linearDamping -> damping property name mismatch.
e.g.
constExample=()=>{const[_,api]=useCircle({linearDamping: someValue,// this doesn't work!damping: someValue,// this works as it's passed through to `propsToBody`, but conflicts with our types!})// ...}
I can think of a few options for fixing this:
We could rename the prop from linearDamping -> damping in this lib to be consistent with p2
We could update propsToBody and keep the API in as-is
Once we start using p2-es in this lib, we could rename damping to linearDamping in p2-es for consistency with cannon
The text was updated successfully, but these errors were encountered:
isaac-mason
changed the title
Body linearDamping and damping prop name mismatch breaks setting linearDamping in hook props
Body damping prop name mismatch breaks setting linearDamping in body hook props
May 14, 2022
isaac-mason
changed the title
Body damping prop name mismatch breaks setting linearDamping in body hook props
Body damping and linearDamping prop name inconsistency breaks providing linearDamping in body hook props
May 14, 2022
isaac-mason
changed the title
Body damping and linearDamping prop name inconsistency breaks providing linearDamping in body hook props
Body 'damping' and 'linearDamping' prop name inconsistency breaks providing 'linearDamping' in body hook props
May 14, 2022
I noticed that the linear damping prop in use-p2 is called
linearDamping
(same as cannon), but in the p2 lib it is calleddamping
.Setting
linearDamping
via the body hook api works, as thesetLinearDamping
op sets thedamping
property correctly:e.g.
But providing
linearDamping
in the props of a body hook doesn't work. From a quick look, it appears that's becausepropsToBody
doesn't have any handling for thelinearDamping
->damping
property name mismatch.e.g.
I can think of a few options for fixing this:
We could rename the prop from
linearDamping
->damping
in this lib to be consistent with p2We could update propsToBody and keep the API in as-is
Once we start using p2-es in this lib, we could rename
damping
tolinearDamping
in p2-es for consistency with cannonThe text was updated successfully, but these errors were encountered: