51 |
52 | setTransformControlsMode(value)}
55 | />
56 |
57 |
58 |
62 |
63 |
64 |
68 |
69 |
70 | }
73 | onClick={() => {
74 | const orbitControls = useEditorStore.getState()
75 | .orbitControlsRef?.current;
76 | const selected = useEditorStore.getState().selected;
77 | let focusObject;
78 |
79 | if (selected) {
80 | focusObject = useEditorStore.getState()
81 | .editablesSnapshot![selected].proxyObject;
82 | }
83 |
84 | if (orbitControls && focusObject) {
85 | focusObject.getWorldPosition(
86 | orbitControls.target as Vector3
87 | );
88 | }
89 | }}
90 | />
91 |
92 |
93 | }
96 | onClick={() => {
97 | const camera = useEditorStore.getState().orbitControlsRef
98 | ?.current?.object;
99 | const selected = useEditorStore.getState().selected;
100 |
101 | let proxyObject;
102 |
103 | if (selected) {
104 | proxyObject = useEditorStore.getState()
105 | .editablesSnapshot![selected].proxyObject;
106 |
107 | if (proxyObject && camera) {
108 | const direction = new Vector3();
109 | const position = camera.position.clone();
110 |
111 | camera.getWorldDirection(direction);
112 | proxyObject.position.set(0, 0, 0);
113 | proxyObject.lookAt(direction);
114 |
115 | proxyObject.parent!.worldToLocal(position);
116 | proxyObject.position.copy(position);
117 |
118 | proxyObject.updateMatrix();
119 |
120 | setEditableTransform(
121 | selected,
122 | proxyObject.matrix.clone()
123 | );
124 | }
125 | }
126 | }}
127 | />
128 |
129 |
130 | } label="Viewport settings">
131 |
132 |
133 |
134 |