UNPKG

react-native-filament

Version:

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

31 lines (30 loc) 923 B
"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?.[0]; const scaleY = localScaling?.[1]; const scaleZ = localScaling?.[2]; const halfX = half?.[0]; const halfY = half?.[1]; const halfZ = 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