added backend connection for conveyor and vehicle mechanics
This commit is contained in:
@@ -9,13 +9,12 @@ import {
|
||||
useSelectedActionSphere,
|
||||
useSimulationPaths,
|
||||
} from "../../../store/store";
|
||||
import * as CONSTANTS from "../../../types/world/worldConstants";
|
||||
|
||||
const Agv = ({
|
||||
lines,
|
||||
plane,
|
||||
}: {
|
||||
lines: Types.RefLines;
|
||||
plane: Types.RefMesh;
|
||||
}) => {
|
||||
const [pathPoints, setPathPoints] = useState<
|
||||
{
|
||||
@@ -34,7 +33,6 @@ const Agv = ({
|
||||
(val: any) => val.modelName === "agv"
|
||||
);
|
||||
|
||||
console.log("agvModels: ", agvModels);
|
||||
let findMesh = agvModels.filter(
|
||||
(val: any) =>
|
||||
val.modeluuid === selectedActionSphere?.path?.modeluuid &&
|
||||
@@ -43,37 +41,37 @@ const Agv = ({
|
||||
|
||||
const result =
|
||||
findMesh.length > 0 &&
|
||||
findMesh[0].type === "Vehicle" &&
|
||||
typeof findMesh[0].point?.actions.start === "object" &&
|
||||
typeof findMesh[0].point?.actions.end === "object" &&
|
||||
"x" in findMesh[0].point.actions.start &&
|
||||
"y" in findMesh[0].point.actions.start &&
|
||||
"x" in findMesh[0].point.actions.end &&
|
||||
"y" in findMesh[0].point.actions.end
|
||||
findMesh[0].type === "Vehicle" &&
|
||||
typeof findMesh[0].points?.actions.start === "object" &&
|
||||
typeof findMesh[0].points?.actions.end === "object" &&
|
||||
"x" in findMesh[0].points.actions.start &&
|
||||
"y" in findMesh[0].points.actions.start &&
|
||||
"x" in findMesh[0].points.actions.end &&
|
||||
"y" in findMesh[0].points.actions.end
|
||||
? [
|
||||
{
|
||||
modelUuid: findMesh[0].modeluuid, // Ensure it's a number
|
||||
modelSpeed: findMesh[0].point.speed,
|
||||
bufferTime: findMesh[0].point.actions.buffer,
|
||||
points: [
|
||||
{
|
||||
x: findMesh[0].position[0],
|
||||
y: findMesh[0].position[1],
|
||||
z: findMesh[0].position[2],
|
||||
},
|
||||
{
|
||||
x: findMesh[0].point.actions.start.x,
|
||||
y: 0,
|
||||
z: findMesh[0].point.actions.start.y,
|
||||
},
|
||||
{
|
||||
x: findMesh[0].point.actions.end.x,
|
||||
y: 0,
|
||||
z: findMesh[0].point.actions.end.y,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
{
|
||||
modelUuid: findMesh[0].modeluuid, // Ensure it's a number
|
||||
modelSpeed: findMesh[0].points.speed,
|
||||
bufferTime: findMesh[0].points.actions.buffer,
|
||||
points: [
|
||||
{
|
||||
x: findMesh[0].position[0],
|
||||
y: findMesh[0].position[1],
|
||||
z: findMesh[0].position[2],
|
||||
},
|
||||
{
|
||||
x: findMesh[0].points.actions.start.x,
|
||||
y: 0,
|
||||
z: findMesh[0].points.actions.start.y,
|
||||
},
|
||||
{
|
||||
x: findMesh[0].points.actions.end.x,
|
||||
y: 0,
|
||||
z: findMesh[0].points.actions.end.y,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
: [];
|
||||
if (result.length > 0) {
|
||||
// setPathPoints((prev) => [...prev, ...result]);
|
||||
@@ -106,12 +104,11 @@ const Agv = ({
|
||||
|
||||
return (
|
||||
<>
|
||||
<PolygonGenerator groupRef={groupRef} lines={lines} plane={plane} />
|
||||
<PolygonGenerator groupRef={groupRef} lines={lines} />
|
||||
<NavMeshDetails
|
||||
lines={lines}
|
||||
setNavMesh={setNavMesh}
|
||||
groupRef={groupRef}
|
||||
plane={plane}
|
||||
/>
|
||||
{pathPoints.map((pair, i) => (
|
||||
<>
|
||||
@@ -149,7 +146,12 @@ const Agv = ({
|
||||
)} */}
|
||||
</>
|
||||
))}
|
||||
<group ref={groupRef} visible={false} name="Meshes"></group>
|
||||
<group ref={groupRef} visible={false} name="Meshes">
|
||||
<mesh rotation-x={CONSTANTS.planeConfig.rotation} position={CONSTANTS.planeConfig.position3D} name="Plane" receiveShadow>
|
||||
<planeGeometry args={[300, 300]} />
|
||||
<meshBasicMaterial color={CONSTANTS.planeConfig.color} />
|
||||
</mesh>
|
||||
</group>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user