react-native-filament
Version:
A real-time physically based 3D rendering engine for React Native
27 lines (26 loc) • 799 B
JavaScript
;
import { useMemo } from 'react';
import { BulletAPI } from '../bulletApi';
export 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 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