- Home /
Snap two objects end to end? C#
hi all,
if i have two rectangular cubes in my assets folder called 'Cube1' and 'Cube2', how can i pull them out of the library and stick them end to end in C#?
Cheers
Answer by hopper · Jun 08, 2015 at 07:35 AM
I don't even think you would need C# to do this unless you need a to call this function when the button is clicked.
You can do this in the scene view by holding down "V" and dragging to the corresponding vertices on the other object.
To call this from a button, I would first create an animation. On frame 0, I would keyframe the position of both objects (put both cube objects inside of an empty GameObject and add the animation there". On the next frame, I would link the two together like I said earlier. Then just put in the C# script: animation.Play("YourAnimationsName");
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Making a bubble level (not a game but work tool) 1 Answer
How to drag object to snap? or move it only in 0.5f 1 Answer
Raycast Snapping Problem. 0 Answers