Drag and Drop 3D Objects around in 3D space and snap to other 3d locations with logic card shuffling


I want to be able to drag and drop three 3D cube cards onto three 3D game spheres center locations and have it snap to place whilst never allowing two cards to occupy the same game spheres.

If the cube is dropped onto a game sphere with an occupying 3d card, it will shunt the other cubes along

The camera is pointing down over the game and the dragging is restricted to X & Z. The camera never moves.

An array that holds the live game memory locations should work but the collision and drag syntax.

Drag & Drop 3D objects in a limited 2D framework HotSpot Snap 3D Objects catch the 3d cards and snap them to the center. MemoryLocation Array to record the cards positions Logic to define the shunting of the cards

The unity3d forums post is here http://forum.unity3d.com/viewtopic.php?t=46566

What syntax should I use to detect the collisions of game card and game sphere which will allow for the shuffling of the cards.?

You can use Physics.OverlapSphere to check if the card collider overlaps with any of the spheres. Essentially, you would check all the spheres in order with a loop:-

var spherePositions: Vector3[];
var sphereRadii: float[];

function Update() {
    for (i = 0; i < spherePositions.Length; i++) {
        var cardsWithin: Collider[] = Physics.OverlapSphere(spherePositions_, sphereRadii*));*_
 _*if (cardsWithin.Length != 0) {*_
 _*// There is something inside the sphere...*_
_*<p>When you know which sphere contains the card you are dragging, it is a fairly straightforward task to shuffle the cards along. You just need to keep the card positions in an array (one for each sphere) and if a card is dropped onto an occupied sphere, just move all the following array elements along by one position.</p>*_

I dont know