First post and total Unity n00b here! Please bare with me :D
I'm trying to make the player a child of a moving object (a train) upon spawning. Normally I'd have a script of transform.parent involved, but I'm stuck since the player does not technically exist until they spawn. Right?
I looked around in the framework Events area, but was not entirely sure which one would be able to do this type of request. I'm hoping there is an event that can do this, because in future I'd like the player to once again be able to become a child of a train for a train ride.
Thanks in advance for the help, and if I'm being an idiot and completely missed something totally obvious, please tell me.
[[Overlong explanation of what I'm attempting is here in case I'm doing this wrong. If you already know how to help me and want to skip this, go right ahead!]]
I want the player to start the game on a train to their destination. Easy enough to spawn them inside the train prefab.
Unfortunately, if you just spawn the player into a moving object, the player and the train have two different speeds and apparently two different physics, so the train "drags" the player along. Totally not ideal.
I want the player to be able to walk around on the train like in real-life, and the only way I've been able to successfully do that so far is to make the player a child of the train. Hence the need for this particular solution!
If you don't want the player to be able to move around on the train, and just want him there while the train does its thing, you could try this: player interacts with train, the interaction event would hide/destroy the player model and set the train as the player, and then sends a move event to make the train/player go to its destination, and then bring back and switch control back to player.
If you're enjoying my products, updates and support, please consider supporting me on patreon.com!