- Home /
Trade positions of 3 objects/cards
hmm sorry for the unclear question. the one im trying to do here is that i have 3 cards which is horizontally arrange
so my 1st card is in 1st spot, 2nd card in 2nd spot, 3rd card in 3rd spot..
so when i drag my 1st card to the 2nd spot the card in the 2nd spot will move to the 1st spot..
Im done with the drag and drop script so what im trying to do is the changing position of the cards..
Thanks for the replies appreciate it.
I'll post it in forum, but if yoiu guys has a solution or can help me.. pls just answer here or reply..thanks
This question is too unclear! It could refer to waypoints: the object moves continuously from one spot to the next one, and when the last one is reached it goes back to the previous one, and so on. Please explain in more detail what you wanna do.
hmm sorry for the unclear question. the one im trying to do here is that i have 3 cards which is horizontally arrange
so my 1st card is in 1st spot, 2nd card in 2nd spot, 3rd card in 3rd spot..
so when i drag my 1st card to the 2nd spot the card in the 2nd spot will move to the 1st spot..
So which part do you need help with? How to drag an object? Or choosing which spot to move it to?
This is essentially the same question I closed yesterday. And it has the same problems. If it is a high-level design question, then it is best asked on the Unity Forums. If you are looking for specific help, you need to break it down into specific technical questions and take it one step at a time. In addition to the multiple different questions there are multiple different ways to implement this functionality, and they depend on the nature of your game...2D or 3D? Rigidbody or direct manipulation of the Transform? $$anonymous$$ove the cards over time, or instant transport? ...
$$anonymous$$aybe you should start with drag and drop. There are a number of UA posts on the issue. Search out some scripts and try them. If you have a problem with a specific script, post the question and script back to the list.
Answer by WizzDE · Aug 19, 2013 at 04:22 AM
Todo:
Check somhow if your 1st card is touching the 2nd card (you could do this with raycasts, coliders, position checking...find a way that matches for you)
As soon as the 1st card is touching the 2nd one move the second one to the position of the first one (you need an vector3 arrayor something like this. The cards could also have a script atached which stores the current possition)
You could move the cards using an animation or vector3.lerp (for every question you have: try to break it down in some smaller questions and then look them up in the docs or here.)
Check out the unity docs!
Your answer
Follow this Question
Related Questions
Setting a starting position for bullet. 1 Answer
Camera rotation around player while following. 6 Answers
Game object position. 1 Answer
Camera movement 1 Answer
Trouble using [Command] in a login script for a server. 1 Answer