I want to pick up a box when I press “e” when in a 3 meter proximity. I am trying to convert CoBlocks code into Type Script so I can get rid of collision with the camera while holding the box. Here are my Coblocks:
This is what I have so far in TypeScript:
let camera = Scene.getItem(“8T2GQDc1”) as CameraItem;
let box1 = Scene.getItem(“mieWUi3c”) as Cuboid;
let box1dist = camera.center.dist(box1.center);
while (true)
{
Input.onKeyDown(pickUpBox(),'e');
}
function pickUpBox(): () => void {
box1.physics.enabled = false;
camera.add(box1);
}
It seems that “() => void” has a problem saying, “A function whose declared type is neither ‘void’ nor ‘any’ must return a value.” I don’t know what it means.