I have properties I'd like to set on an Object3D that are currently not supported by react-three. It occurred to me to make a PR with a commit like this one, however, it doesn't make sense to me to manually set all of these props. For any prop that doesn't require special parsing, why not just pass it along?
I'm guessing that you have a good reason not to do this but I'm wondering what that is.
applyTHREEObject3DPropsToObject: function(THREEObject3D, oldProps, props) {
const { position,
quaternion,
visible,
scale,
up,
lookat,
...rest
} = props;
// these props have defaults
if (typeof position !== 'undefined') {
THREEObject3D.position.copy(position);
} else {
THREEObject3D.position.set(0,0,0);
}
if (typeof quaternion !== 'undefined') {
THREEObject3D.quaternion.copy(quaternion);
} else {
THREEObject3D.quaternion.set(0,0,0,1); // no rotation
}
if (typeof visible !== 'undefined') {
THREEObject3D.visible = visible;
} else {
THREEObject3D.visible = true;
}
if (typeof scale === "number") {
THREEObject3D.scale.set(scale, scale, scale);
} else if (scale instanceof THREE.Vector3) {
// copy over scale values
THREEObject3D.scale.copy(scale);
} else {
THREEObject3D.scale.set(1,1,1);
}
if (typeof up !== 'undefined') {
this._THREEObject3D.up.copy(up);
}
if (typeof lookat !== 'undefined') {
this._THREEObject3D.lookAt(lookat);
}
Object.assign(THREEObject3D, rest);
},
I have properties I'd like to set on an
Object3D
that are currently not supported byreact-three
. It occurred to me to make a PR with a commit like this one, however, it doesn't make sense to me to manually set all of these props. For any prop that doesn't require special parsing, why not just pass it along?I'm guessing that you have a good reason not to do this but I'm wondering what that is.