playMaker

Author Topic: Parent not moving with child?  (Read 2417 times)

plinko

  • Playmaker Newbie
  • *
  • Posts: 11
Parent not moving with child?
« on: September 06, 2016, 05:50:08 AM »
Hello. I'm having an issue with spawn points in my project and I've narrowed it down. I have an empty gameobject called "Player_System" with a Player and Camera inside of it. Everything works fine, but the Player_System doesn't move with the child. This means that when I use Set Position on the Player_System, I get sent off the map. Is there a way of making it follow the child? I tried a hacky fix which was to set the Player_System position to the Player's location on death, but it still sends me outside of walls and I imagine the same issue is happening when I Set Position a second time. I apologize if this is extremely simple, but I've been trying for a few hours now and I just can't figure it out. I also realize I could be going about this completely wrong and an alternate solution would be fine as well. I would really appreciate it if I could fix this thing. I want to continue on with my project!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Parent not moving with child?
« Reply #1 on: September 06, 2016, 06:13:27 AM »
Hi,
When you move a parent, the child objects will move with it
and when you move the child the parent will not.

Now if you want to change the position of a parent and not the child you need to detach the child, then move the parent and then attach the child back.
you can use the set parent action for this.

Commonly the parent is used for moving the player.

i am not sure what you want to do, but maybe for the death position you could save it in a vector3 and use that for what you want to do?

plinko

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Parent not moving with child?
« Reply #2 on: September 06, 2016, 05:15:48 PM »
Thanks for the info. I've actually done Set Position on the actual Player instead and it works properly. The only issue now is that the Camera doesn't go to the new position instantly. It goes there slowly and that's kind of strange. Is that normal behavior? If possible I would like the Camera to get there instantly.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Parent not moving with child?
« Reply #3 on: September 06, 2016, 08:24:02 PM »
Hi,
Is the camera set as child of the player and/or does the camera have some smooth follow or something
Maybe you can make a video of what is going on.
if possible also show the states and actions that you are using

plinko

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Parent not moving with child?
« Reply #4 on: September 06, 2016, 10:02:31 PM »
I figured it out! It was my fault. I have another empty gameobject where the camera should follow and I'm using Move Towards on it. The speed was set to 25 so I just set it much higher and it's instant. Maybe not the best solution? But it works for what I need.