Drag object around using the mouse

I have a box, and I would like to make it so that you could have fun with it by tossing it around and whatnot. I tried using ray casting but i was having troubles. Help?

Link: https://playcanvas.com/editor/project/620521
Where to find script: scripts/campaign/pickup
Scene: Campaign

What problem(s) are you having and what kind of behaviours are you looking for? Something like this: https://www.miniclip.com/games/virtual-voodoo/en/#privacy-consents

I can’t look at it, I am on my phone right now, and it takes me to the App Store for some reason. The problem is I’m just having trouble learning how to convert the mouse to world position. I know about screen to world, but I’m still having trouble with it. I also want it to use rigid body physics to make it look better. Also, the game is a 3D side scroller, so I don’t want to make the box move on the z. Tell me if you need to know anything else.

This is the same account as @Werdie_Alt
That link you sent that sends me to a Halloween game is exactly what I’m trying to do

You should really keep with just one account, it confuses the heck out of people when you both post in the same thread :sweat_smile:

You are on the right track from the looks of the project but you have several overlapping rigidbodies and collisions where the player is. (This code sample may help more about recasting with the world https://developer.playcanvas.com/en/tutorials/place-an-entity-with-physics/ )

In Virtual Voodoo, I think I used a physics joint (which isn’t exposed API but accessible all the same) when the player grabs the doll which allows for that dragging/spinning motion.

What do you mean overlapping rigid bodies? And where?