bug fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { useThree, useFrame } from "@react-three/fiber";
|
||||
import { Vector3 } from "three";
|
||||
import { Group, Vector3 } from "three";
|
||||
import { CameraControls } from '@react-three/drei';
|
||||
import { useLimitDistance, useRenderDistance, useSelectedFloorItem } from '../../../../store/builder/store';
|
||||
import { useSelectedAsset } from '../../../../store/simulation/useSimulationStore';
|
||||
@@ -12,7 +12,8 @@ import { GLTFLoader } from "three/examples/jsm/Addons";
|
||||
const distanceWorker = new Worker(new URL("../../../../services/factoryBuilder/webWorkers/distanceWorker.js", import.meta.url));
|
||||
|
||||
function Models({ loader }: { loader: GLTFLoader }) {
|
||||
const { controls, camera } = useThree();
|
||||
const { controls, camera, raycaster, pointer, gl } = useThree();
|
||||
const assetGroupRef = useRef<Group>(null);
|
||||
const { assetStore } = useSceneContext();
|
||||
const { assets } = assetStore();
|
||||
const { selectedFloorItem, setSelectedFloorItem } = useSelectedFloorItem();
|
||||
@@ -42,9 +43,32 @@ function Models({ loader }: { loader: GLTFLoader }) {
|
||||
}
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
// const canvasElement = gl.domElement;
|
||||
|
||||
// const onClick = () => {
|
||||
// if (!assetGroupRef.current || assetGroupRef.current.children.length === 0) return;
|
||||
// raycaster.setFromCamera(pointer, camera);
|
||||
|
||||
// const intersects = raycaster.intersectObjects(assetGroupRef.current.children, true);
|
||||
|
||||
// if (intersects.length > 0) {
|
||||
// console.log('intersects: ', intersects);
|
||||
// }
|
||||
// }
|
||||
|
||||
// canvasElement.addEventListener('click', onClick);
|
||||
|
||||
// return () => {
|
||||
// canvasElement.removeEventListener('click', onClick);
|
||||
// }
|
||||
|
||||
}, [camera])
|
||||
|
||||
return (
|
||||
<group
|
||||
name='Asset Group'
|
||||
ref={assetGroupRef}
|
||||
onPointerMissed={(e) => {
|
||||
e.stopPropagation();
|
||||
if (selectedFloorItem) {
|
||||
|
||||
@@ -163,7 +163,7 @@ function RoboticArmAnimator({ HandleCallback, restPosition, ikSolver, targetBone
|
||||
|
||||
// Handle nearest points and final path (including arc points)
|
||||
useEffect(() => {
|
||||
if (circlePoints.length > 0 && currentPath.length > 0) {
|
||||
if (circlePoints.length > 0 && currentPath.length > 0 && ikSolver.mesh) {
|
||||
|
||||
let start = currentPath[0];
|
||||
let end = currentPath[currentPath.length - 1];
|
||||
@@ -251,7 +251,6 @@ function RoboticArmAnimator({ HandleCallback, restPosition, ikSolver, targetBone
|
||||
}
|
||||
|
||||
if (currentPhase === 'end-to-rest') {
|
||||
console.log('currentPhase: ', currentPhase);
|
||||
const armbotModel = scene.getObjectByProperty("uuid", armBot.modelUuid);
|
||||
const armbotWorldPos = new THREE.Vector3();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user