- Home /
How to combine two custom objects?
Hello Everyone,
I am new to Unity3d. I have one question for you guys, being a newbie on this, I am not sure this is even possible in unity or not. Here is my question:
I have two custom objects (3d objects created by my graphics guy) - .skp/obj files, One of the object is like a cylinder (hollow from middle) and another one is a pipe. Is it possible to move the pipe object inside of a cylinder object and so that it keep moving until the pipe touches the inner surface of the cylinder? Is it even possible to move one object into the another until one of the objects fits into another?
Any help is appreciated.
Many Thanks,
Lokesh Sehgal
So you want a script that stops the pipe object from moving if it touches the cylinder object?
Thanks for writing back. I just want to know whether or not it is possible to combine two custom objects, like a cylinder and a pipe, and can pipe move inside of a cylinder and then fit into it? Is it also possible to have these two as one object? Eg: Pipe Stuck inside of a cylinder?
Thanks
Answer by ScroodgeM · Aug 18, 2012 at 07:45 PM
visual geometry is not real world. you can place one object inside other as well. but if outer object is opaque, you just will not see an inner object.
to fix relative position of one object to another, you just should make one object as a child for another. in that way you can do anything with parent object, and child will stay at fixed position relative to parent.
to detect a point of 'touch' usually used colliders and casts (ray-, sphere- etc). you can just 'test' an external surface coordinate using raycast and move your second object exactly to this coordinate.
also to 'stuck' object you can just parent one to another, or even combine geometry - this will decrease also a drawcalls for objects, and will make them a single geometry model.
Answer by lokesh.sehgal · Aug 20, 2012 at 11:54 AM
Thanks, it helps. I will post more as I will move forward, thanks again. Cheers.
Your answer
![](https://koobas.hobune.stream/wayback/20220613075842im_/https://answers.unity.com/themes/thub/images/avi.jpg)