bug fix in ik and code optimization
This commit is contained in:
@@ -61,30 +61,12 @@ function MaterialInstance({ material }: { readonly material: MaterialSchema }) {
|
||||
function getCurrentSpeed(productUuid: string, modelUuid: string) {
|
||||
const event = getEventByModelUuid(productUuid, modelUuid)
|
||||
if (event) {
|
||||
if (event.type === 'transfer') {
|
||||
return event.speed;
|
||||
}
|
||||
|
||||
if (event.type === 'vehicle') {
|
||||
return event.speed;
|
||||
}
|
||||
|
||||
if (event.type === 'machine') {
|
||||
if (event.type === 'transfer' || event.type === 'machine' || event.type === 'storageUnit') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (event.type === 'roboticArm') {
|
||||
if (event.type === 'vehicle' || event.type === 'roboticArm' || event.type === 'human') {
|
||||
return event.speed;
|
||||
}
|
||||
|
||||
if (event.type === 'storageUnit') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (event.type === 'human') {
|
||||
return event.speed;
|
||||
}
|
||||
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect } from 'react'
|
||||
import { useEffect } from 'react'
|
||||
import MaterialInstance from './instance/materialInstance'
|
||||
import { useSceneContext } from '../../../scene/sceneContext';
|
||||
|
||||
|
||||
@@ -173,13 +173,16 @@ const ArmBotUI = () => {
|
||||
|
||||
const targetMesh = scene?.getObjectByProperty("uuid", selectedArmBotData?.modelUuid || '');
|
||||
|
||||
const iks = targetMesh?.userData?.iks;
|
||||
const firstIK = Array.isArray(iks) && iks.length > 0 ? iks[0] : {};
|
||||
|
||||
const { handlePointerDown } = useDraggableGLTF(
|
||||
updatePointToState,
|
||||
{
|
||||
minDistance: targetMesh?.userData?.iks[0]?.minDistance || 1.2,
|
||||
maxDistance: targetMesh?.userData?.iks[0]?.maxDistance || 2,
|
||||
maxheight: targetMesh?.userData?.iks[0]?.maxheight || 0.6,
|
||||
minheight: targetMesh?.userData?.iks[0]?.minheight || 1.9,
|
||||
minDistance: firstIK.minDistance ?? 1.2,
|
||||
maxDistance: firstIK.maxDistance ?? 2,
|
||||
maxheight: firstIK.maxheight ?? 0.6,
|
||||
minheight: firstIK.minheight ?? 1.9,
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user