Search Knowledge Base by Keyword
Drag & Drop
Drag & Drop is the ability to set a target destination for an object to go into. This feature is extremely useful to define snapping zones for gaming, educational, healthcare experiences, or any time you want your user to place an element at a specific spot.
In the following example, the hat is dragged and dropped on the character’s head:
Drag & Drop is a whole system. Follow the steps below to setup the Drag & Drop for an object:
- Create an IO that will be your Drop object, the object you want to drop somewhere specific like the hat in the example (see Create your first IO);
- Click on Enable Drag And Drop on the root of the Drop Object;
- Add or generate Drop target(s) and place it where you want to drop the object (see explanations below);
- Configure the Drop object (see explanations below).
- You can choose any object in the scene to be your drop target.
- Alternatively you can create an automatic drop target generated automatically in the root of your IO.
- Once the “Enable Drag And Drop” is checked you will be able to see a field called “generate targets“.
- Just enter the number of targets you want to generate and hit the “GO” button.
- Your target is automatically generated and all setup*, you just have to place it where you want to drop the object.
Warning: In this version, when a target is generated it will clone all the interactions you already have inside your object; make sure to remove them or change them according to your needs.
Drag and Drop Parameters
At the top level of an Interactive Object, you have a Gaze_InteractiveObject component. Here, if “Enable Drag And Drop” is set to true, you can define the parameters to allow a drop as follow:
- Drop on occupied targets: if this is checked you allow an object to be dropped on a target where there has already been a dropped object.
- Respect X/Y/Z Axis (and mirrored): if you choose to constrain the drop to the target’s rotation, here you can specify which axis are mandatory to be matched in order to allow the drop. I.E. if you check ‘Respect X Axis’, the drop object must have the same orientation on its X axis than the drop target (with the specified angle threshold).
- Angle Threshold: represents the precision in which the orientation of the drop object on the drop target should be as a percentage. I.E. if the threshold is set to 100 with Respect X Axis activated, that means that the drop object’s rotation on the x axis should be exactly the same as the x axis orientation of the drop target.
- Minimum Distance: the distance between the drop object and the drop target. If not within this distance, the drop is not allowed.
- Attached: if this is checked the dropped object will be fixed in the target position after dropped.
- Snap on Drop: if you want the object to have an animation when he is reaching the target position.
- Snap before Drop: if you want this animation to happen before releasing the object
- Time to Snap: used to set the duration of the transition from where you release the object to its drop target location.