Teleproting an entity to position and become child entity

So I have this game and I was wondering if perhaps someone knew how to have a button that can allow you to select an Object to teleport to orientation and make it become a child entity of the position until they push an on-screen button again?

Hi @Jacob_McBride1!

Do you mean something like the project below?

https://playcanvas.com/project/874243/overview/drag-and-drop

1 Like

yes but my project is top-down and not first-person.

Do you know how to do this?

I don’t understand exactly what you try to achieve, but if it is kind of the same as the project I shared, you can find most things you need in the project.

okay so, theres a player who has a cam attached to it. and a child entity of the camera is where I want to teleport the object to

Can I add you to the project so you can help?

I’m unable to check your project at the moment.

Please check what I do in my example project.

How do you want to select the entity that you want to reparent? Is it a weapon or something?

1 Like

No its an object. The player needs to pick it up and take it somewhere else.

the example shows it in first person, but my game isn’t a first person either.

The steps are probably the same.

How can the player pick it up?

the player needs to walk up to the object and left click it

What is the player and entity to pick up on that screenshot? Does the player use the mouse to select the entity?

yes it is supposed to. (the player is the blue cube)

I added you to the project so you can help me there

And which entity need to be picked up?

I’m unable to help in the editor at the moment. I suggest to add the dragAndDrop.js script to your camera entity, to get started. You probably need to change a few things. For example the raycast end should be the mouse position instead of the middle of the screen.

I dont know how to do that