- Home /
How to flip and stack a gameobject?
I have a problem to flip a box in 4 direction upside down, here's the image what I want to recreate:
How to achieve that? And if recreate that possible, how to flip and stack it? Here's the image:
I've already tried to flip the box using dotween, but the object still flip by its center. What I want is to flip the whole box so the "upside" of the box is facing down and the box position moved along with the flip process. Thanks! Hope it's easy to understand my question. I really need help.
Answer by myzzie · Nov 17, 2020 at 12:06 PM
RotateAround lets you assign a pivot. Instead of rotating around the local position, you can pick any position you want to rotate around.
Hey thanks, I'll try it later. For my second question, did you know how to stack the box? And if it stacked, how I could "merge" them so I can use RotateAround in most below box?
Vector3 origin;
float height;
List<Boxes> boxes;
var targetPosition = new Vector3(origin.x, origin.y + (boxes.count + height), origin.z);
When the box reaches the target position, add it to the list.
To merge, create a new gameobject and set it where you want the pivot, then foreach box in boxes do box.SetParent(gameobject)
Your answer
Follow this Question
Related Questions
Flip over an object (smooth transition) 3 Answers
How do i get the Raycast rotation? 1 Answer
Distribute terrain in zones 3 Answers
Collision problem 4 Answers