Default orientation of mesh

Lets say I want to load sword 3d model but it is really large and in unwanted rotation.

I assume I could edit it in 3d modeling software but what would be best way to adjust it with three.js?

I could adjust its scale and rotation properties but then later if I am going to adjust those again it becomes pain when I want to reset its orientation to “default” because I need to remember those “proper” default values.

  1. It’s best if you import an object in a default rotation (so 0/0/0 should be for example the sword pointing up.) It gets messy really quickly, if you don’t do that and try to programmatically adjust default rotations for models. So you should edit it with 3d modelling software just to get that default state right.
  2. If you want to save a rotation state, it’s best to use Object3D.quaternion. You can then always return to that rotation using Object3D.setRotationFromQuaternion.
    Scale you can just save as a vector, there’s no magic there.

Oh, I think I should start looking into 3d modeling software at some point in that case.

The problem is that I am not sure yet what scales I would like to have to the model so would be nice to do it programmatically at start for quick testing.

Do you have any code example how I could change the scale and rotation of the object but keeping the property values at 0,0,0’s if I want to modify them later?

After loading it, you can place the model within an Object3D and transform the model to your desired size / rotation. Then use the parent Object3D for any other transformations.

Object3D {
  rotation: (0,0,0), // Use these to transform the correctly resized model
  scale: (1,1,1),
  children: [
    model: {
      rotation: (rotated to default orientation),  // Set these only once, after loading the model
      scale: (rescaled to default size)
    }
  ]
}

Oh yeah, that could work as well.

Thanks for the help!