fix: Update position and rotation handling for selected human in HumanUi
This commit is contained in:
@@ -70,6 +70,14 @@ function HumanUi() {
|
|||||||
rotation: selectedHuman.rotation,
|
rotation: selectedHuman.rotation,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (outerGroup.current) {
|
||||||
|
outerGroup.current.position.set(
|
||||||
|
selectedHuman.position[0],
|
||||||
|
selectedHuman.position[1],
|
||||||
|
selectedHuman.position[2]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const action = selectedHuman.point.action;
|
const action = selectedHuman.point.action;
|
||||||
|
|
||||||
if (action.pickUpPoint?.position && outerGroup.current) {
|
if (action.pickUpPoint?.position && outerGroup.current) {
|
||||||
@@ -77,6 +85,9 @@ function HumanUi() {
|
|||||||
const localPosition = outerGroup.current.worldToLocal(worldPos.clone());
|
const localPosition = outerGroup.current.worldToLocal(worldPos.clone());
|
||||||
setStartPosition([localPosition.x, 1, localPosition.z]);
|
setStartPosition([localPosition.x, 1, localPosition.z]);
|
||||||
setStartRotation(action.pickUpPoint.rotation || [0, 0, 0]);
|
setStartRotation(action.pickUpPoint.rotation || [0, 0, 0]);
|
||||||
|
} else {
|
||||||
|
setStartPosition([0, 1, 0]);
|
||||||
|
setStartRotation([0, Math.PI, 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.dropPoint?.position && outerGroup.current) {
|
if (action.dropPoint?.position && outerGroup.current) {
|
||||||
@@ -84,6 +95,9 @@ function HumanUi() {
|
|||||||
const localPosition = outerGroup.current.worldToLocal(worldPos.clone());
|
const localPosition = outerGroup.current.worldToLocal(worldPos.clone());
|
||||||
setEndPosition([localPosition.x, 1, localPosition.z]);
|
setEndPosition([localPosition.x, 1, localPosition.z]);
|
||||||
setEndRotation(action.dropPoint.rotation || [0, Math.PI, 0]);
|
setEndRotation(action.dropPoint.rotation || [0, Math.PI, 0]);
|
||||||
|
} else {
|
||||||
|
setEndPosition([0, 1, 0]);
|
||||||
|
setEndRotation([0, 0, 0]);
|
||||||
}
|
}
|
||||||
}, [selectedEventSphere, outerGroup.current, selectedAction, humans]);
|
}, [selectedEventSphere, outerGroup.current, selectedAction, humans]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user