- Home /
How to Place and arrange 3D cards using Grid and Bounds
Hello friends,
I'm developing a Cards game (Like rummy/poker). Usually, the cards are in 2D, bit easy to handle drag cards and place one on the other in ScrollRect. When one UI item is dragged and dropped, other objects adjust accordingly. In my case, The 53 cards are 3D plane objects. 13 cards served to user. Now the user should drag and drop, sort, select multiple cards and group or place cards on the other card, accordingly other cards move and adjust above or below each other. Drag and drop done already. Seriously i dont know how to achieve the rest manually. Could some one help??// There's no much help in the forum or in google on this topic. As I've explored, it seems Grid Layout and Bounds would help in achieving this// But dont know how to implement bounds and Grid on my own. Unity documentation is just simple and not helping much. Please help.. Its been a week, breaking my head.. ! Please give some idea on how to arrange cards on proper intervals, managing one on the other adjusting accordingly etc.,
What you see in the screenshot, I've arranged cards on an interval of fixed value in x,y. This has to be arranged in grid and while dragging and dropping it should be automatically on grid and one on the other. Please help
Use Pivot position from transform
In this case, it will transform.position.x
You would have a list of card transform or rectTransform
You just have to loop through that list and increment transform.position.x by a distance
Hi, thanks for your reply. I did not use UI for the cards. I am using 3D cards. Yes i used the transform.position to arrange the cards. Arranging the cards and dragging them is ok. But It needs to be on dragged and kept on one another either above a card or below a card, And the other cards should move and give space accordingly. Do u have any idea of bounds and grids?
And another thing. It kinda dumb for using UI rect layout for card in both performance and code design term.
I would just use BoxCollider with On$$anonymous$$ouseDrag()
Your answer
Follow this Question
Related Questions
Get position of the centre of each grid tile 1 Answer
Drag and Drop menu and Save load game. 0 Answers
Trading Card Game 5 Answers
Some questions regarding card game 2 Answers
Object within bounds of another object 2 Answers