SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
84 stars 18 forks source link

Minor (but very annoying) issue with the object editor and workzone (Global space transform copying) #4304

Closed DanielWillett closed 4 months ago

DanielWillett commented 5 months ago

When you use Ctrl + B / Ctrl + N to copy a transform of one object, the rotation isn't retained in GLOBAL space. I assume it's supposed to keep the rotation even in global space? if not it should at least compensate for the 90° rotation all objects have and rotate it accordingly so it's not sideways like below.

image

I think all that needs to be changed is to use

dragCoordinate == GLOBAL ? selection[0].transform.rotation : handles.GetPivotRotation()

in EditorObjects.Update instead of getting it from the handle when in global mode, since in global mode the pivot rotation is set to Quaternion.identity in calculateHandleOffsets. image

The in-game workzone also has the exact same bug.

SDGNelson commented 5 months ago

Hmm that sounds right. Thanks for the report. 🤔

SDGNelson commented 4 months ago

I agree the current behavior is bad. I think there are a few options:

  1. Copy the first object's rotation, as proposed. I think this could easily be confusing, however, as the transform handle would still be aligned with the global axes.
  2. Reset to (-90, 0, 0). I think this could be useful in some cases, and the vast majority of object surely are designed with that (annoying... 😬) default rotation.
  3. Copy only the position, not the rotation. i.e., move the pivot to the copied position without affecting rotation.

For the meantime I've made the 3rd change because of all of them I think it might be the most potentially useful and intuitive. Do you think that's reasonable?

DanielWillett commented 4 months ago

Yeah that's a good way to do it I think.

iirc the world/local space setting doesn't save on restarts, so that could also help some as usually you have to switch over to copy transform either way.

Could definitely see benefits to the second option too if you wanted to 'reset' an object's rotation or something like that. Maybe hold ctrl to reset instead of copy could be useful.