How would I "attach" an object to another object in 3D perfectly?
-
Say I have a player object, and it’s a person model. And I also have another, a hat object, and it’s an Engineer Hat model. I know how to position it right above the player, so it looks like the player is wearing the crown, and that works, but only works when the player is static and not moving. (My player is moved with WASD). I had a piece of code (forgot to save it), but it’s not perfect. The crown stays backs and slowly follows the player’s head, and when the character stops moving, it returns back to its normal place.
I assumed this block would do the job but it doesn’t:
and same for this one too:
I don’t really have a good code example incase you ask, sorry, but how would I just like make 2 objects become one (smoothly too), like the hat and the player, so when the player moves or turns, so does the hat because the hat is attached to the player seamlessly?
-
Setting the avatar to be the parent of the hat is the common solution. Can you share the project? We will investigate why it doesn’t work.
And here is a simple example:
https://play.creaticode.com/projects/66d91bb68d45d7f8ac438f76
-
@info-creaticode My project is shared, but you won’t find the code there because like I said i forgot to save it, so sorry. But the project you provided as the example says “Not found”
-
Please try again. The project is accessible now. The code is like this:
-
@info-creaticode Ok, I’m gonna try to do that (hopefully it works). Thank you!
-
@jeffreyrb03-gmail so i’ve realized my mistakes, it might’ve been a little bit of the wrong object being selected, because the issues I would face were the hat would be controlled instead and I’d have a walking hat and no person, and varieties of that and the camera just failing because of idk. Also maybe because in your example you had “and update position/scale ( No )” and I had yes .
I still haven’t fixed my issue yet but this did help me get closer to achieving the effect I want, and it’s gonna be awesome when it’s done, so thank you!
-
Yes. Most likely, you had the hat as the “selected sprite object” instead of the person, so when you use a motion block, the hat is moved.