- Home /
Linking two objects together
Hi,
I have two different objects that I would like to attach together, in such a way that if one moves, the other does as well and vice-versa. Parenting doesn't work, because it doesn't go both ways. I don't want to create an parent empty game object that overlaps the two other objects since it is very important that the user can chose which object he wants to have as a reference to movement.
Thank you very much
Answer by syclamoth · Dec 22, 2011 at 01:25 AM
Sorry about my previous post, that was a stupid way to do it.
You should make both objects children of a single empty, and always use that for movement. Your comment about wanting to chose which object the user wants a reference to isn't exactly a valid one- the end user doesn't know anything about how it works internally, so all you have to do is make sure that any time they would translate one of the objects, instead translate the parent object. I really don't see why you can't do it this way- it's simple, and guaranteed to work.
Answer by MrProcessor · Jan 24, 2018 at 01:05 AM
Actually I did this as @Bourbeau did.And my other child object started moving a while later so parenting may not be the solution in every case. Im still trying to find a way to to that.
Your answer
Follow this Question
Related Questions
How would I attached a gameobject to a prefab that is spawned at a specific time? 1 Answer
Quickly isolate GameObjects in Hierarchy with scripts in them? 2 Answers
GO.AddComponent just adds an empty Script 1 Answer
How to target a gameobject in C# to play animation 2 Answers
Getting score when the two object attach each other 0 Answers