@playcanvas/react
Version:
A React renderer for PlayCanvas – build interactive 3D applications using React's declarative paradigm.
22 lines • 980 B
JavaScript
"use client";
import { useComponent } from "../hooks/index.js";
import { Entity } from "playcanvas";
import { validatePropsPartial, createComponentDefinition, getStaticNullApplication } from "../utils/validation.js";
/**
* The Camera component makes an entity behave like a camera and gives you a view into the scene.
* Moving the container entity will move the camera.
*
* @param {CameraProps} props - The props to pass to the camera component.
*
* @example
* <Entity>
* <Camera fov={75} near={0.1} far={1000} />
* </Entity>
*/
export const Camera = (props) => {
const safeProps = validatePropsPartial(props, componentDefinition);
useComponent("camera", safeProps, componentDefinition.schema);
return null;
};
const componentDefinition = createComponentDefinition("Camera", () => new Entity("mock-camera", getStaticNullApplication()).addComponent('camera'), (component) => component.system.destroy(), "CameraComponent");
//# sourceMappingURL=Camera.js.map