Picking up Boxes/The ability to interact with Rigidbodies

Well, I want the ability to pick up boxes and move them around, say… the same way one would do in a game like portal or half life 2. I hope that some of you can help me with this problem, as my game isn’t really fun without something to interact with.

Hi @Suslendrw and welcome!

Maybe my drag and drop example project can help you.


It sadly doesn’t work It gives me an error that says:

TypeError: Cannot read properties of undefined (reading ‘screenToWorld’)
at DragAndDrop.drag (https: //launch. playcanvas. com/api/assets/files/New%20Folder/dragAndDrop.js?id=170411456&branchId=bd936506-ab37-4e42-9fa2-aad05068ba33:35:40)
at Mouse.fire (https://code.playcanvas.com/playcanvas-1.68.1.dbg.js:1647:21)
at Mouse._handleDown (https://code. playcanvas. com/playcanvas-1.68.1.dbg.js:29180:11)

It has to be assigned to a camera entity for it to work

1 Like


It didn’t work.

If you share the editor link of your project someone can take a look.

It all works in the example project and you can see the setup of it as well.


There is a problem with the script on the camera entity. I guess removing the script from the entity and add it again will solve this problem.

Mostly this problem occurs when you for example rename a script, but I’m not sure what the reason is in this case.