UNPKG

react-native-filament

Version:

A real-time physically based 3D rendering engine for React Native

25 lines 1.08 kB
import { useMemo } from 'react'; import { BulletAPI } from '../bulletApi'; export function useCylinderShape(props) { const { half, localScaling } = props ?? {}; const scaleX = localScaling === null || localScaling === void 0 ? void 0 : localScaling[0]; const scaleY = localScaling === null || localScaling === void 0 ? void 0 : localScaling[1]; const scaleZ = localScaling === null || localScaling === void 0 ? void 0 : localScaling[2]; const halfX = half === null || half === void 0 ? void 0 : half[0]; const halfY = half === null || half === void 0 ? void 0 : half[1]; const halfZ = half === null || half === void 0 ? void 0 : half[2]; return useMemo(() => { if (halfX == null || halfY == null || halfZ == null) { return undefined; } const shape = BulletAPI.createCylinderShape(halfX, halfY, halfZ); if (scaleX != null && scaleY != null && scaleZ != null) { shape.localScaling = [scaleX, scaleY, scaleZ]; } return shape; }, [halfX, halfY, halfZ, scaleX, scaleY, scaleZ]); } //# sourceMappingURL=useCylinderShape.js.map