Closed patreeceeo closed 3 years ago
This addresses #119.
I needed to be able to change the physics parameters of existing bodies in my scene, and couldn't figure out another way to do it. For instance, this change allows me to do:
export default (props) => { const [ref] = useSphere(() => ({ position: [props.center.x, props.center.y, props.radius], velocity: props.velocity.direction, props.velocity.magnitude, }), null, [props.center, props.velocity]); return ( <mesh ref={ref}> <sphereBufferGeometry args={[props.radius]} /> <meshLambertMaterial /> </mesh> ) }
and the position and velocity of the sphere rendered with this code will update whenever those props change.
Would love to see this merged. Seems an easy fix to validate.
Still hoping someone from Poimandres can comment, or merge if it's ready 🙏🏻
sorry for the long wait
This addresses #119.
I needed to be able to change the physics parameters of existing bodies in my scene, and couldn't figure out another way to do it. For instance, this change allows me to do:
and the position and velocity of the sphere rendered with this code will update whenever those props change.