UNPKG

react-native-filament

Version:

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

31 lines (30 loc) 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useCylinderShape = useCylinderShape; var _react = require("react"); var _bulletApi = require("../bulletApi"); 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 (0, _react.useMemo)(() => { if (halfX == null || halfY == null || halfZ == null) { return undefined; } const shape = _bulletApi.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