i was trying to export function from this file to another file but then i am not able to do that .here is the code I want to export the function from but then whe i try to use an export at the end of the file I get the error "export 'startConsume' is not defined" if anyone could help me i would be much aprreciated.
import React, { useRef, useEffect } from "react";
import { useFrame, useThree } from "react-three-fiber";
import * as THREE from "three";
const Actor = () => {
const meshRef = useRef();
const { scene } = useThree();
useEffect(() => {
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({ color: 0x00000 });
const mesh = new THREE.Mesh(geometry, material);
mesh.rotateY(Math.PI);
// Set initial properties and functions
mesh.instructions = [];
mesh.target = new THREE.Object3D().copy(mesh, false);
mesh.targetRadiansOnY = 0;
mesh.currentRadiansOnY = 0;
mesh.mass = 0.1;
mesh.velocity = new THREE.Vector3();
mesh.angularVelocity = 0.015;
mesh.topSpeed = 0.05;
mesh.topAccelleration = 0.0015;
mesh.accelleration = new THREE.Vector3();
mesh.currentInstruction = null;
mesh.gravityForce = new THREE.Vector3(0.0, -0.01, 0.0);
// Add mesh to the scene
scene.add(mesh);
meshRef.current = mesh;
return () => {
// Clean up the mesh when the component unmounts
scene.remove(mesh);
};
}, [scene]);
// Update function to consume commands
const consumeCommands = (mmm) => {
console.log('aa')
};
const startConsume = (instructions) => {
console.log(instructions);
// this.instructions = instructions;
// if(this.instructions.length>0){
// this.currentInstruction = this.instructions.shift();
// this._consumeCommandsNew(this.currentInstruction);
// }else{
// console.log("no instructions to execute");
// }
}
// Set the consumeCommands function as an update function
useFrame(() => {
consumeCommands();
});
return null; // We don't render anything for this component
};
export {Actor, startConsume};
// export {startConsume};