react-three-fiber: When setting a transform related prop to undefined r3f noops the update instead of resetting to default values

Video of the bug

https://user-images.githubusercontent.com/6801309/218726432-bf3944db-3914-4e76-bcb1-6a8f64f62cb2.mov

Steps to reproduce

  1. Set a scene objects transform props:
function Box() {
  return <mesh position={[1,1,1]}><boxGeometry args={[1,1,1]} />
}
  1. Unset the same scene objects transform prop:
function Box() {
  return <mesh><boxGeometry args={[1,1,1]} />
}
  1. Scene object does not move back to the default position, r3f instead noops and does nothing.

This affects all transform related props (position/rotation/scale). I would expect them all to instead of noop reset back to the default values:

  • position [0,0,0]
  • rotation [0,0,0]
  • scale [1,1,1]

If I can be pointed to where in the code base I should look at I can contribute a fix 😄.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 22 (22 by maintainers)

Most upvoted comments